Could you help with one problem: i made json-file with grammar (include cyrillic symbols).
All works fine, but tokens "и", "И" behave strangely =)
In word "Привет" symbol "и" will be highlighted (but it's just a letter in this case) ((
"comment" : "comment"
,"atom" : "atom"
,"keyword" : "keyword"
,"builtin" : "builtin"
,"operator" : "operator"
,"identifier" : "variable"
,"property" : "attribute"
,"number" : "number"
,"string" : "string"
"comment" : {"type":"comment","tokens":[
// line comment
// start, end delims (null matches end-of-line)
[ "//", null ],
// block comments
// start, end delims
[ "/*", "*/" ]
]}
,"identifier" : "RE::/[_A-Za-z$][_A-Za-z0-9$]*/"
,"property" : "RE::/[_A-Za-z$][_A-Za-z0-9$]*/"
,"number" : [
// floats
"RE::/\\d*\\.\\d+(e[\\+\\-]?\\d+)?/",
"RE::/\\d+\\.\\d*/",
"RE::/\\.\\d+/",
// integers
// decimal
"RE::/[1-9]\\d*(e[\\+\\-]?\\d+)?L?/",
// just zero
"RE::/0(?![\\dx])/"
]
,"string" : {"type":"escaped-block","escape":"\\","tokens":
// start, end of string (can be the matched regex group ie. 1 )
[ "RE::/(['\"])/", 1 ]
}
,"operator" : {"tokens":[
"+", "-", "*", "/", "не"
]}
,"delimiter" : {"tokens":[
"(", ")", "[", "]", ",", ":"
]}
,"atom" : {"autocomplete":true,"tokens":[
"ИСТИНА", "ЛОЖЬ", "и", "или", "ИЛИ", "И"
]}
,"keyword" : {"autocomplete":true,"tokens":[
"если", "Если", "ЕСЛИ", "в случае", "иначе", "тогда", "содержит", "то", "хоть один из", "ни одного из"
]}
,"builtin" : {"autocomplete":true,"tokens":[
"КАЖДЫЙ", "ЛЮБОЙ", "ИМПЕРАТИВ", "ТРЕБОВАНИЕ", "Требование"
]}
"ldsl" : "comment | number | string | keyword | operator | atom | builtin | identifier"
Hi, Nikos!
Could you help with one problem: i made json-file with grammar (include cyrillic symbols).
All works fine, but tokens "и", "И" behave strangely =)
In word "Привет" symbol "и" will be highlighted (but it's just a letter in this case) ((
Grammar:
`// 1. a partial javascript grammar in simple JSON format
var ldsl_grammar = // a partial javascript grammar in simple JSON format
{
// prefix ID for regular expressions used in the grammar
"RegExpID" : "RE::",
// Style model
"Style" : {
},
// Lexical model
"Lex" : {
},
// Syntax model (optional)
"Syntax" : {
},
// what to parse and in what order
"Parser" : [ ["ldsl"] ]
};`