Skip to content

Commit

Permalink
Allow : inside field-names #81
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaumgarten committed Aug 15, 2021
1 parent 31bc87e commit 011089a
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/js/prism-nolol.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Prism.languages.nolol = {
'keyword': /\b(if|then|else|end|goto|define|while|do|include|macro|break|continue|block|line|expr)\b/i,
'operator': /\b(and|or|not)\b/i,
'function': /[a-z0-9_]+(?=\()/i,
'variable': /:[a-zA-Z0-9_]+|^[a-zA-Z]+[a-zA-Z0-9_]*/,
'variable': /:[a-zA-Z0-9_:]+|^[a-zA-Z]+[a-zA-Z0-9_]*/,
'constant': /[0-9]+(\.[0-9]+)?/
};
2 changes: 1 addition & 1 deletion docs/js/prism-yolol.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Prism.languages.yolol = {
'keyword': /((?<=^|\\s|[^a-zA-Z_:])(if|then|else|end|goto)+)|(?<=^|\\s|[^a-zA-Z0-9_:])(not|abs|sqrt|sin|cos|tan|asin|acos|atan)(?=[^a-zA-Z0-9_:]|$)/i,
'operator': /(?<=[^a-zA-Z0-9_:])(and|or)(?=[^a-zA-Z0-9_:])/i,
'function': /[a-z0-9_]+(?=\()/i,
'variable': /:[a-zA-Z0-9_]+|^[a-zA-Z]+[a-zA-Z0-9_]*/,
'variable': /:[a-zA-Z0-9_:]+|^[a-zA-Z]+[a-zA-Z0-9_]*/,
'constant': /[0-9]+(\.[0-9]+)?/
};
2 changes: 2 additions & 0 deletions examples/yolol/operations4.yolol
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ i="abc" j=i-- k=--i :testd=i=="a" and j=="ab" and k=="a"
foo=2
foo^=10
:textexpass=foo==1024
:::boo:::=123
:testbullshit=:::boo:::==123
:done=1
1 change: 1 addition & 0 deletions examples/yolol/operations4_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ cases:
testra: 1
testfact: 1
textexpass: 1
testbullshit: 1


2 changes: 1 addition & 1 deletion pkg/parser/ast/tokenizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ var keywordRegex1 = regexp.MustCompile(`(?i)^(and|or|not|abs|sqrt|sin|cos|tan|as
var keywordRegex2 = regexp.MustCompile(`(?i)^(if|then|else|end|goto)`)
var keywordRegexes = []*regexp.Regexp{keywordRegex1, keywordRegex2}

var identifierRegex = regexp.MustCompile("^:[a-zA-Z0-9_]+|^[a-zA-Z]+[a-zA-Z0-9_]*")
var identifierRegex = regexp.MustCompile("^:[a-zA-Z0-9_:]+|^[a-zA-Z]+[a-zA-Z0-9_]*")

var numberRegex = regexp.MustCompile("^[0-9]+(\\.[0-9]+)?")

Expand Down
2 changes: 1 addition & 1 deletion vscode-yolol/syntaxes/nolol.tmGrammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"name": "keyword.operator"
},
"extvariable": {
"match": ":[a-zA-Z0-9_]+",
"match": ":[a-zA-Z0-9_:]+",
"name": "variable.language"
},
"variable": {
Expand Down
2 changes: 1 addition & 1 deletion vscode-yolol/syntaxes/yolol.tmGrammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"name": "keyword.operator"
},
"extvariable": {
"match": ":[a-zA-Z0-9_]+",
"match": ":[a-zA-Z0-9_:]+",
"name": "variable.language"
},
"variable": {
Expand Down

0 comments on commit 011089a

Please sign in to comment.