Skip to content

problem with highlighting #11

@Metatr0n

Description

@Metatr0n

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" : {

 "comment"                      : "comment"

,"atom"                         : "atom"

,"keyword"                      : "keyword"

,"builtin"                      : "builtin"

,"operator"                     : "operator"

,"identifier"                   : "variable"

,"property"                     : "attribute"

,"number"                       : "number"

,"string"                       : "string"

},

// Lexical model

"Lex" : {

 "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":[

                                "КАЖДЫЙ", "ЛЮБОЙ", "ИМПЕРАТИВ", "ТРЕБОВАНИЕ", "Требование"

                                ]}

},

// Syntax model (optional)

"Syntax" : {

"ldsl"                           : "comment | number | string | keyword | operator | atom | builtin | identifier"

},

// what to parse and in what order

"Parser" : [ ["ldsl"] ]

};`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions