Comments (3)
Secret plugins -- looking forward to it!
I suppose we could do this. Wouldn't the regex for a valid Julia variable name be the same as the regex for a value function name? I guess there are some symbols that are allowed to be function names, but now variable names (I'm thinking unicode operators like \dot[TAB]
and \in[TAB]
).
from atom-language-julia.
Matching against identifiers starting with unicode word characters, and containing only those, number characters and !
, seems to work well. Could also check the source of Base.isidentifier
in case that's not exact.
from atom-language-julia.
For reference:
is_id_start_char(c::Char) = ccall(:jl_id_start_char, Cint, (UInt32,), c) != 0
is_id_char(c::Char) = ccall(:jl_id_char, Cint, (UInt32,), c) != 0
function isidentifier(s::AbstractString)
i = start(s)
done(s, i) && return false
(c, i) = next(s, i)
is_id_start_char(c) || return false
while !done(s, i)
(c, i) = next(s, i)
is_id_char(c) || return false
end
return true
end
isidentifier(s::Symbol) = isidentifier(string(s)
and the ccall
functions (in src/flisp/julia_extensions.c):
DLLEXPORT int jl_id_start_char(uint32_t wc)
{
if ((wc >= 'A' && wc <= 'Z') || (wc >= 'a' && wc <= 'z') || wc == '_')
return 1;
if (wc < 0xA1 || wc > 0x10ffff)
return 0;
const utf8proc_property_t *prop = utf8proc_get_property(wc);
return is_wc_cat_id_start(wc, prop->category);
}
DLLEXPORT int jl_id_char(uint32_t wc)
{
if ((wc >= 'A' && wc <= 'Z') || (wc >= 'a' && wc <= 'z') || wc == '_' ||
(wc >= '0' && wc <= '9') || wc == '!')
return 1;
if (wc < 0xA1 || wc > 0x10ffff)
return 0;
const utf8proc_property_t *prop = utf8proc_get_property(wc);
utf8proc_propval_t cat = prop->category;
if (is_wc_cat_id_start(wc, cat)) return 1;
if (cat == UTF8PROC_CATEGORY_MN || cat == UTF8PROC_CATEGORY_MC ||
cat == UTF8PROC_CATEGORY_ND || cat == UTF8PROC_CATEGORY_PC ||
cat == UTF8PROC_CATEGORY_SK || cat == UTF8PROC_CATEGORY_ME ||
cat == UTF8PROC_CATEGORY_NO ||
// primes (single, double, triple, their reverses, and quadruple)
(wc >= 0x2032 && wc <= 0x2037) || (wc == 0x2057) ||
// Other_ID_Continue
wc == 0x0387 || wc == 0x19da || (wc >= 0x1369 && wc <= 0x1371))
return 1;
return 0;
}
from atom-language-julia.
Related Issues (20)
- `′` breaks variable syntax highlighting
- md"a" syntax breaks highlighting
- Tokenize TODO in comments HOT 3
- Make more specific token for `::` HOT 4
- Weird case of function tokenization when end of line comment includes parentheses HOT 1
- colored documentation syntax as comment HOT 1
- Highlight attributes of a module or constructor HOT 4
- `Markdown.@md_str` breaks syntax highlighting HOT 8
- Incorrect syntax highlighting when splatting a range
- Unicode operators aren't highlighted HOT 1
- Additional keywords HOT 1
- String interpolation with generator is broken HOT 3
- Unicode letters break type name HOT 1
- Command interpolation
- Syntax coloring for doctests
- New `public` keyword not recognized
- Future development after Atom's sunset HOT 1
- Tokenization of commas changed to `source.julia`, which affects Julia Color Themes HOT 8
- Broken REPL syntax highlighting of multi-line inputs
- Highlight prompts in REPL syntax highlighting
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atom-language-julia.