Skip to content

Commit 0d847e8

Browse files
Syntax highlight issues, fixes #85
1 parent d4977c3 commit 0d847e8

4 files changed

Lines changed: 37 additions & 14 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"printableName": "Cache Web Terminal",
66
"description": "Web-based terminal emulator for Caché administering.",
77
"author": "ZitRo",
8-
"version": "4.2.1",
8+
"version": "4.2.2",
99
"gaID": "UA-83005064-2",
1010
"releaseNumber": 26,
1111
"scripts": {

src/client/js/parser/grammar.js

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,17 @@ rule("cosCommand").split(
430430
{ CI, value: "if", class: "keyword" },
431431
{ CI, value: "i", class: "keyword" }
432432
]).whitespace().call("expression").optWhitespace().split(
433-
char("{").branch().optWhitespace().call("cosCommand").optWhitespace().char("}")
434-
.optWhitespace().split(
433+
char("{").optWhitespace().branch().call("cosCommand").optWhitespace().split(
434+
char("}").optWhitespace().split(
435435
id({ CI, value: "else", class: "keyword" }).optWhitespace()
436-
.char("{").optWhitespace().call("cosCommand").optWhitespace().char("}"),
436+
.char("{").optWhitespace().branch().call("cosCommand").optWhitespace().split(
437+
char("}").exit(),
438+
any().merge()
439+
),
437440
id({ CI, value: "elseif", class: "keyword" }).whitespace().call("expression")
438-
.optWhitespace().char("{").merge()
441+
.optWhitespace().char("{").optWhitespace().merge()
442+
),
443+
any().merge()
439444
),
440445
call("cosCommand")
441446
).exit(),
@@ -453,12 +458,18 @@ rule("cosCommand").split(
453458
).optWhitespace().split(
454459
char(",").optWhitespace().merge(),
455460
any()
456-
).char("{").optWhitespace().call("cosCommand").optWhitespace().char("}").exit(),
461+
).char("{").optWhitespace().branch().call("cosCommand").optWhitespace().split(
462+
char("}").exit(),
463+
any().merge()
464+
),
457465
id({ CI, value: "while", class: "keyword" }).whitespace().branch().call("expression")
458466
.optWhitespace().split(
459467
char(",").optWhitespace().merge(),
460-
char("{").optWhitespace().call("cosCommand").optWhitespace().char("}").exit()
461-
)
468+
char("{").optWhitespace().branch().call("cosCommand").optWhitespace().split(
469+
char("}").exit(),
470+
any().merge()
471+
)
472+
)
462473
).end();
463474

464475
rule("deviceParameters").branch().split(
@@ -504,10 +515,16 @@ rule("doArgument").split(
504515
char({ value: ".", type: "routine", class: "global" }).merge(),
505516
any()
506517
),
507-
id({ class: "variable", type: "variable" }).char({ value: ".", type: "*" }).split(
518+
id({ class: "variable", type: "variable" }).char({ value: ".", type: "*" }).branch().split(
508519
char({ value: "%", type: "memberMethod" }),
509520
any()
510-
).id({ type: "memberMethod" }).char("(").call("argumentList").char(")"),
521+
).id({ type: "memberMethod" }).split(
522+
char("(").call("argumentList").char(")").split(
523+
char({ value: ".", type: "*" }).merge(),
524+
any()
525+
),
526+
char({ value: ".", type: "*" }).merge()
527+
),
511528
call("class")
512529
).call("postCondition").exit().end();
513530

@@ -737,7 +754,11 @@ rule("SQLExpression").split(
737754
whitespace()
738755
).merge()
739756
),
740-
id({ class: "variable", type: "sqlFieldName" })
757+
id({ class: "variable", type: "sqlFieldName" }).split(
758+
char({ value: "_", class: "variable", type: "sqlFieldName" })
759+
.id({ class: "variable", type: "sqlFieldName" }),
760+
any()
761+
)
741762
).optWhitespace().split(
742763
split(
743764
char("+"),
@@ -750,6 +771,7 @@ rule("SQLExpression").split(
750771
any()
751772
),
752773
id({ CI, value: "and", class: "keyword" }),
774+
id({ CI, value: "like", class: "keyword" }),
753775
id({ CI, value: "or", class: "keyword" })
754776
).optWhitespace().call("SQLExpression"),
755777
any()

src/client/js/parser/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ export function getAutomaton () {
3030
// if (!oa[i])
3131
// continue;
3232
// for (let r of oa[i]) {
33-
// table.push([+i].concat(r[0] ? (r[0].type + (r[0].value ? ` (${r[0].value.value || r[0].value})` : ""))
34-
// : r[0]).concat(r.slice(1)));
33+
// table.push([+i].concat(r[0] ? (r[0].type + (r[0].value ? ` (${r[0].value.value
34+
// || r[0].value.type || r[0].value.class || r[0].value || r[0].type || r[0].class})`
35+
// : "")) : r[0]).concat(r.slice(1)));
3536
// }
3637
// }
3738
// if (console.table)

src/client/js/parser/pushdownAutomaton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ function processChain (chain, branchingStack, startingIndex) {
310310
completeBackStack();
311311
// console.log(index, "SPLITTING", elem.value);
312312
for (let c of elem.value) {
313-
let temp = processChain(c, branchingStack, index);
313+
let temp = processChain(c, branchingStack.slice(), index);
314314
// console.log("GOT BACK", temp);
315315
stack = stack.concat(temp[0]);
316316
backStack = backStack.concat(temp[1]);

0 commit comments

Comments
 (0)