Permalink
Browse files

allow most chars as identifier

  • Loading branch information...
1 parent 790a71b commit 22ce3a47f201e4cfad44b6fd29be7e8fc100cd13 @hax hax committed Dec 27, 2012
Showing with 6 additions and 3 deletions.
  1. +1 −1 examples/nest.jedi
  2. +2 −1 src/expression.ometajs
  3. +3 −1 src/text.ometajs
View
2 examples/nest.jedi
@@ -1,3 +1,3 @@
div
@onclick = "\{1}"
- :unsafe "<script>alert({1+1})</script>"
+ :unsafe "<script>alert({测试+1})</script>"
View
3 src/expression.ometajs
@@ -1,4 +1,5 @@
"import string, toUTF16 from './util'"
+"import UnicodeText from './text'"
"export Expression"
ometa Expression {
@@ -7,7 +8,7 @@ ometa Expression {
primary = literal | listLiteral | tupleLiteral | path | symbol,
symbol = ('*' | ~keyword nameChar+):s -> [#Symbol, string(s)],
- nameChar = letterOrDigit | '$' | '_' | '-' | '&',
+ nameChar = UnicodeText.nameChar | '$',
path = symbol?:start segment+:segments
-> [#Path, start].concat(segments),
View
4 src/text.ometajs
@@ -4,7 +4,7 @@ ometa SimpleText {
lines newline:nl = string:s -> s.split(nl),
newline -> /\r?\n/,
whitespace = ' ' | '\t' | '\n',
- nameChar = letterOrDigit | '_' | '-' | '&',
+ nameChar = letterOrDigit | '_' | '-' | '&' | char:c ?unicodeLetter.test(c) -> c,
END
}
@@ -26,6 +26,8 @@ ometa CompatibleText <: UnicodeText {
var whitespace = /[\t\n \u00A0\u3000\u2000-\u200A\u202F\u205F\u2028\u2029\u1680\u180E\uFEFF]/
var discouraged = /[\u0000-\u0008\u000B-\u001F\u007F-\u009F\uFDD0-\uFDEF\uFFFE\uFFFF]/g
+var unicodeLetter = /[\u100-\uFFFD]/i
+
function checkDiscouraged(line, n, lines) {
var c = line.search(discouraged)

0 comments on commit 22ce3a4

Please sign in to comment.