mirror of
https://github.com/danbulant/lang-surrealql
synced 2026-05-19 04:18:34 +00:00
specialization and highlight fixes
This commit is contained in:
parent
c1f38bace8
commit
18ad57fda2
3 changed files with 6 additions and 4 deletions
|
|
@ -17,8 +17,8 @@ export let parser = baseParser.configure({
|
|||
Statement: continuedIndent()
|
||||
}),
|
||||
styleTags({
|
||||
"StringPrefix as asc desc collate numeric": t.keyword,
|
||||
"select from where group by having order limit return transaction begin break cancel commit continue use db ns sleep show changes for table since info namespace database scope table value at with noindex index only omit split start timeout parallel explain full in": t.keyword,
|
||||
"StringPrefix As Asc Desc Collate Numeric": t.keyword,
|
||||
"Select From Where Group By Having Order Limit Return Transaction Begin Break Cancel Commit Continue Use Db Ns Sleep Show Changes For Table Since Info Namespace Database Scope Table Value At With Noindex Index Only Omit Split Start Timeout Parallel Explain Full In": t.keyword,
|
||||
Escape: t.escape,
|
||||
Bool: t.bool,
|
||||
"DivideOrMultiply AddOrSubtract": t.arithmeticOperator,
|
||||
|
|
@ -34,7 +34,7 @@ export let parser = baseParser.configure({
|
|||
BlockComment: t.blockComment,
|
||||
String: t.string,
|
||||
Constant: t.constant(t.variableName),
|
||||
"return break ForStatement/for if else then": t.controlKeyword,
|
||||
"Return Break ForStatement/For If Else Then": t.controlKeyword,
|
||||
"DurationUnit": t.unit,
|
||||
"None Null": t.null,
|
||||
"RecordID": t.special(t.variableName),
|
||||
|
|
|
|||
|
|
@ -260,12 +260,14 @@ export const tokens = new ExternalTokenizer((input, stack) => {
|
|||
}, {contextual: false})
|
||||
|
||||
export const specializeIdent = (text, stack) => {
|
||||
text = text.toLowerCase()
|
||||
if(specmap.has(text)) {
|
||||
return specmap.get(text)
|
||||
}
|
||||
return -1
|
||||
}
|
||||
export const extendIdent = (text, stack) => {
|
||||
text = text.toLowerCase()
|
||||
if(cspecmap.has(text)) {
|
||||
return cspecmap.get(text)
|
||||
}
|
||||
|
|
|
|||
2
test.js
2
test.js
|
|
@ -1,4 +1,4 @@
|
|||
import {baseParser} from "./dist/index.js"
|
||||
console.log(baseParser.parse('select field from type::table($var) where $var > 1 and field2 @1@ field1 timeout 10s').toString())
|
||||
console.log(baseParser.parse('select * from documents where contents @@ "test"').toString())
|
||||
console.log(baseParser.parse('select * from documents where test > 1').toString())
|
||||
console.log(baseParser.parse('SELECT * FROM documents').toString())
|
||||
Loading…
Reference in a new issue