Skip to content

Commit

Permalink
Merge pull request #140 from arenadata/feature/ADH-5407
Browse files Browse the repository at this point in the history
feature/ADH-5407 highlight compare operators
  • Loading branch information
remizov-arena authored Dec 6, 2024
2 parents af20120 + 69fa9ce commit 0a00278
Show file tree
Hide file tree
Showing 7 changed files with 780 additions and 822 deletions.
1 change: 1 addition & 0 deletions smart-frontend/app/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vite.config.ts
.lintstagedrc.js
.storybook
src/utils/smartRule/SmartRule*.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ monaco.editor.defineTheme('ssmruleTheme', {
{ token: 'matches.ssmrule', foreground: smartRuleHighlighterStyles.syntaxMatches, fontStyle: 'bold' },
{ token: 'string.ssmrule', foreground: smartRuleHighlighterStyles.syntaxString, fontStyle: 'italic' },
{ token: 'symbols.ssmrule', foreground: smartRuleHighlighterStyles.syntaxSymbols },
{ token: 'opeqcmp.ssmrule', foreground: smartRuleHighlighterStyles.syntaxCompare },
{ token: 'opcmp.ssmrule', foreground: smartRuleHighlighterStyles.syntaxCompare },
{ token: 'or.ssmrule', foreground: smartRuleHighlighterStyles.syntaxSymbols },
{ token: 'and.ssmrule', foreground: smartRuleHighlighterStyles.syntaxSymbols },
{ token: 'unrecognized.ssmrule', foreground: smartRuleHighlighterStyles.syntaxError },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ $syntaxTimeintvalconst: #b3ff00;
syntaxId: $syntaxId;
syntaxSymbols: $syntaxSymbols;
syntaxMatches: $syntaxMatches;
syntaxCompare: $syntaxMatches;
syntaxString: $syntaxString;
syntaxError: $syntaxError;

Expand Down Expand Up @@ -54,6 +55,10 @@ $syntaxTimeintvalconst: #b3ff00;
color: $syntaxSymbols;
}

&>.opeqcmp\.ssmrule, &>.opcmp\.ssmrule {
color: $syntaxMatches;
}

&>:is(.unrecognized\.ssmrule, .error\.ssmrule) {
color: $syntaxError;
}
Expand Down
504 changes: 244 additions & 260 deletions smart-frontend/app/src/utils/smartRule/SmartRuleLexer.ts

Large diffs are not rendered by default.

70 changes: 54 additions & 16 deletions smart-frontend/app/src/utils/smartRule/SmartRuleListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,64 @@
* limitations under the License.
*/

/* eslint-disable spellcheck/spell-checker */

/* eslint-disable prettier/prettier */

// Generated from SmartRule.g4 by ANTLR 4.13.2

import { ParseTreeListener } from 'antlr4';
import {ParseTreeListener} from "antlr4";


import type { RuleLineContext , CommentLineContext , ObjTypeOnlyContext , ObjTypeWithContext , TriTimePointContext , TriCycleContext , TriFileEventContext , TriOnceContext , DuringexprContext , ObjfilterContext , ConditionsContext , BvAndORContext , BvIdContext , BvNotContext , BvCompareexprContext , BvCurveContext , CmpIdLongContext , CmpIdStringContext , CmpIdStringMatchesContext , CmpTimeintvalTimeintvalContext , CmpTimepointTimePointContext , TieTiIdExprContext , TieTpExprContext , TieConstContext , TieTiExprContext , TieCurvesContext , TpeNowContext , TpeTimeConstContext , TpeTimeExprContext , TpeCurvesContext , TpeTimeIdContext , CommonexprContext , NumricexprIdContext , NumricexprCurveContext , NumricexprAddContext , NumricexprMulContext , NumricexprLongContext , StrPlusContext , StrOrdStringContext , StrIDContext , StrCurveContext , StrTimePointStrContext , CmdletContext , IdAttContext , IdObjAttContext , IdAttParaContext , IdObjAttParaContext , OPCMPContext , OprContext , FileEventContext , ConstLongContext , ConstStringContext , ConstTimeInvervalContext , ConstTimePointContext } from './SmartRuleParser.js';
import { RuleLineContext } from "./SmartRuleParser.js";
import { CommentLineContext } from "./SmartRuleParser.js";
import { ObjTypeOnlyContext } from "./SmartRuleParser.js";
import { ObjTypeWithContext } from "./SmartRuleParser.js";
import { TriTimePointContext } from "./SmartRuleParser.js";
import { TriCycleContext } from "./SmartRuleParser.js";
import { TriFileEventContext } from "./SmartRuleParser.js";
import { TriOnceContext } from "./SmartRuleParser.js";
import { DuringexprContext } from "./SmartRuleParser.js";
import { ObjfilterContext } from "./SmartRuleParser.js";
import { ConditionsContext } from "./SmartRuleParser.js";
import { BvAndORContext } from "./SmartRuleParser.js";
import { BvIdContext } from "./SmartRuleParser.js";
import { BvNotContext } from "./SmartRuleParser.js";
import { BvCompareexprContext } from "./SmartRuleParser.js";
import { BvCurveContext } from "./SmartRuleParser.js";
import { CmpIdLongContext } from "./SmartRuleParser.js";
import { CmpIdStringContext } from "./SmartRuleParser.js";
import { CmpIdStringMatchesContext } from "./SmartRuleParser.js";
import { CmpTimeintvalTimeintvalContext } from "./SmartRuleParser.js";
import { CmpTimepointTimePointContext } from "./SmartRuleParser.js";
import { TieTiIdExprContext } from "./SmartRuleParser.js";
import { TieTpExprContext } from "./SmartRuleParser.js";
import { TieConstContext } from "./SmartRuleParser.js";
import { TieTiExprContext } from "./SmartRuleParser.js";
import { TieCurvesContext } from "./SmartRuleParser.js";
import { TpeNowContext } from "./SmartRuleParser.js";
import { TpeTimeConstContext } from "./SmartRuleParser.js";
import { TpeTimeExprContext } from "./SmartRuleParser.js";
import { TpeCurvesContext } from "./SmartRuleParser.js";
import { TpeTimeIdContext } from "./SmartRuleParser.js";
import { CommonexprContext } from "./SmartRuleParser.js";
import { NumricexprIdContext } from "./SmartRuleParser.js";
import { NumricexprCurveContext } from "./SmartRuleParser.js";
import { NumricexprAddContext } from "./SmartRuleParser.js";
import { NumricexprMulContext } from "./SmartRuleParser.js";
import { NumricexprLongContext } from "./SmartRuleParser.js";
import { StrPlusContext } from "./SmartRuleParser.js";
import { StrOrdStringContext } from "./SmartRuleParser.js";
import { StrIDContext } from "./SmartRuleParser.js";
import { StrCurveContext } from "./SmartRuleParser.js";
import { StrTimePointStrContext } from "./SmartRuleParser.js";
import { CmdletContext } from "./SmartRuleParser.js";
import { IdAttContext } from "./SmartRuleParser.js";
import { IdObjAttContext } from "./SmartRuleParser.js";
import { IdAttParaContext } from "./SmartRuleParser.js";
import { IdObjAttParaContext } from "./SmartRuleParser.js";
import { OprContext } from "./SmartRuleParser.js";
import { FileEventContext } from "./SmartRuleParser.js";
import { ConstLongContext } from "./SmartRuleParser.js";
import { ConstStringContext } from "./SmartRuleParser.js";
import { ConstTimeInvervalContext } from "./SmartRuleParser.js";
import { ConstTimePointContext } from "./SmartRuleParser.js";


/**
Expand Down Expand Up @@ -587,16 +635,6 @@ export default class SmartRuleListener extends ParseTreeListener {
* @param ctx the parse tree
*/
exitIdObjAttPara?: (ctx: IdObjAttParaContext) => void;
/**
* Enter a parse tree produced by `SmartRuleParser.oPCMP`.
* @param ctx the parse tree
*/
enterOPCMP?: (ctx: OPCMPContext) => void;
/**
* Exit a parse tree produced by `SmartRuleParser.oPCMP`.
* @param ctx the parse tree
*/
exitOPCMP?: (ctx: OPCMPContext) => void;
/**
* Enter a parse tree produced by `SmartRuleParser.opr`.
* @param ctx the parse tree
Expand Down
Loading

0 comments on commit 0a00278

Please sign in to comment.