Skip to content

Commit

Permalink
Support comments in Math and Sequence.
Browse files Browse the repository at this point in the history
Bug:#64
  • Loading branch information
ArthurSonzogni committed May 15, 2023
1 parent b2bf80f commit 81d56ea
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
17 changes: 15 additions & 2 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,19 @@ option {
font-weight: bold;
}

.Math > .VARIABLE,
.Math > .STRING {
.Math > .COMMENT,
.Math > .LINE_COMMENT {
color:gray;
}

.Math > .VARIABLE {
color:var(--fg-color);
}

.Math > .STRING {
color:var(--code-green-color);
}

.Math > .LPAREN ,
.Math > .RPAREN ,
.Math > .LBRACE,
Expand Down Expand Up @@ -401,6 +409,11 @@ option {
color:var(--code-red-color);
font-weight: bold;
}
.Sequence > .COMMENT,
.Sequence > .LINE_COMMENT
{
color:gray;
}

.GraphPlanar > .STRING,
.GraphPlanar > .ID {
Expand Down
4 changes: 2 additions & 2 deletions src/translator/flowchart/Flowchart.g4
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ grammar Flowchart;

// Ignored TOKENS
WS: [ \t\n]+ -> channel(HIDDEN);
COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
LINE_COMMENT: '//' .*? ('\r'? '\n' | EOF) -> channel(HIDDEN);
COMMENT: '/' '*' .*? '*' '/' -> channel(HIDDEN);
LINE_COMMENT: '/' '/' (~('\n'))* -> channel(HIDDEN);

SEMICOLON: ';';
PL: '(';
Expand Down
6 changes: 5 additions & 1 deletion src/translator/math/Math.g4
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,13 @@ EQ : '=' ;
POW : '^' ;
SUBSCRIPT: '_' ;
EOL : '\r\n' | '\n' ;
WS : [ \t]+ -> channel(HIDDEN);

fragment CHAR : ~[!+-<>=_^(){}[\] \t\r\n"*] | [.0123456789];
VARIABLE: CHAR+;
// Ignored TOKENS
WS: [ \t]+ -> channel(HIDDEN);
COMMENT: '/' '*' .*? '*' '/' -> channel(HIDDEN);
LINE_COMMENT: '/' '/' .*? ('\n' | EOF) -> channel(HIDDEN);
// vim: filetype=antlr
5 changes: 5 additions & 0 deletions src/translator/sequence/Sequence.g4
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ grammar Sequence;

// Lexer -----

// Ignored TOKENS
WS: [\t]+ -> channel(HIDDEN);
COMMENT: '/' '*' .*? '*' '/' -> channel(HIDDEN);
LINE_COMMENT: '/' '/' (~('\n'))* -> channel(HIDDEN);

ARROW_RIGHT: '->';
ARROW_LEFT: '<-';
COMMA: ':';
Expand Down

0 comments on commit 81d56ea

Please sign in to comment.