Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add yml lang #4058

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
352 changes: 251 additions & 101 deletions abb/abbLexer.g4
Original file line number Diff line number Diff line change
@@ -1,107 +1,257 @@
// $antlr-format alignTrailingComments true, columnLimit 150, maxEmptyLinesToKeep 1, reflowComments false, useTab false


// $antlr-format allowShortRulesOnASingleLine true, allowShortBlocksOnASingleLine true, minEmptyLines 0, alignSemicolons ownLine


// $antlr-format alignColons trailing, singleLineOverrulesHangingColon true, alignLexerCommands true, alignLabels true, alignTrailers true

lexer grammar abbLexer;

options {
caseInsensitive = true;
}

MODULE : 'module';
ENDMODULE : 'endmodule';
PROC : 'PROC';
ENDPROC : 'ENDPROC';
LOCAL : 'LOCAL';
CONST : 'CONST';
PERS : 'PERS';
VAR : 'VAR';
TOOLDATA : 'TOOLDATA';
WOBJDATA : 'WOBJDATA';
SPEEDDATA : 'SPEEDDATA';
ZONEDATA : 'ZONEDATA';
CLOCK : 'CLOCK';
BOOL : 'BOOL';
ON_CALL : '\\ON';
OFF_CALL : '\\OFF';

SLASH : '/';
EQUALS : ':=';
COMMA : ',';
CURLY_OPEN : '{';
CURLY_CLOSE : '}';
COLON : ':';
SEMICOLON : ';';
BRACKET_OPEN : '(';
BRACKET_CLOSE : ')';
SQUARE_OPEN : '[';
SQUARE_CLOSE : ']';
DOT : '.';
DOUBLEDOT : '..';
REL_BIGGER : '>';
REL_BIGGER_OR_EQUAL : '>=';
REL_SMALLER : '<';
REL_SMALLER_OR_EQUAL : '<=';
REL_EQUAL : '==';
REL_NOTEQUAL : '<>';
PLUS : '+';
MINUS : '-';
MULTIPLY : '*';
PERCENT : '%';
HASH : '#';

WS: (' ' | '\t' | '\u000C') -> skip;

NEWLINE: '\r'? '\n';

LINE_COMMENT: '!' ~ ('\n' | '\r')* -> skip;

BOOLLITERAL: 'FALSE' | 'TRUE';

CHARLITERAL: '\'' (EscapeSequence | ~ ('\'' | '\\' | '\r' | '\n')) '\'';

STRINGLITERAL: '"' (EscapeSequence | ~ ('\\' | '"' | '\r' | '\n'))* '"';

fragment EscapeSequence:
'\\' (
'b'
| 't'
| 'n'
| 'f'
| 'r'
| '"'
| '\''
| '\\'
| '0' .. '3' '0' .. '7' '0' .. '7'
| '0' .. '7' '0' .. '7'
| '0' .. '7'
)
;

FLOATLITERAL:
('0' .. '9')+ '.' ('0' .. '9')* Exponent?
| '.' ('0' .. '9')+ Exponent?
| ('0' .. '9')+ Exponent
;

fragment Exponent: 'E' ('+' | '-')? ('0' .. '9')+;

INTLITERAL: ('0' .. '9')+ | HexPrefix HexDigit+ HexSuffix | BinPrefix BinDigit+ BinSuffix;

fragment HexPrefix: '\'' 'H';

fragment HexDigit: '0' .. '9' | 'A' .. 'F';

fragment HexSuffix: '\'';

fragment BinPrefix: '\'' 'B';

fragment BinDigit: '0' | '1';

fragment BinSuffix: '\'';

IDENTIFIER: IdentifierStart IdentifierPart*;

fragment IdentifierStart: 'A' .. 'Z' | '_';

fragment IdentifierPart: IdentifierStart | '0' .. '9';

options { caseInsensitive = true; }
MODULE
: 'module'
;

ENDMODULE
: 'endmodule'
;

PROC
: 'PROC'
;

ENDPROC
: 'ENDPROC'
;

LOCAL
: 'LOCAL'
;

CONST
: 'CONST'
;

PERS
: 'PERS'
;

VAR
: 'VAR'
;

TOOLDATA
: 'TOOLDATA'
;

WOBJDATA
: 'WOBJDATA'
;

SPEEDDATA
: 'SPEEDDATA'
;

ZONEDATA
: 'ZONEDATA'
;

CLOCK
: 'CLOCK'
;

BOOL
: 'BOOL'
;

ON_CALL
: '\\ON'
;

OFF_CALL
: '\\OFF'
;

SLASH
: '/'
;

EQUALS
: ':='
;

COMMA
: ','
;

CURLY_OPEN
: '{'
;

CURLY_CLOSE
: '}'
;

COLON
: ':'
;

SEMICOLON
: ';'
;

BRACKET_OPEN
: '('
;

BRACKET_CLOSE
: ')'
;

SQUARE_OPEN
: '['
;

SQUARE_CLOSE
: ']'
;

DOT
: '.'
;

DOUBLEDOT
: '..'
;

REL_BIGGER
: '>'
;

REL_BIGGER_OR_EQUAL
: '>='
;

REL_SMALLER
: '<'
;

REL_SMALLER_OR_EQUAL
: '<='
;

REL_EQUAL
: '=='
;

REL_NOTEQUAL
: '<>'
;

PLUS
: '+'
;

MINUS
: '-'
;

MULTIPLY
: '*'
;

PERCENT
: '%'
;

HASH
: '#'
;

WS
: (' ' | '\t' | '\u000C') -> skip
;

NEWLINE
: '\r'? '\n'
;

LINE_COMMENT
: '!' ~ ('\n' | '\r')* -> skip
;

BOOLLITERAL
: 'FALSE'
| 'TRUE'
;

CHARLITERAL
: '\'' (EscapeSequence | ~ ('\'' | '\\' | '\r' | '\n')) '\''
;

STRINGLITERAL
: '"' (EscapeSequence | ~ ('\\' | '"' | '\r' | '\n'))* '"'
;

fragment EscapeSequence
: '\\' ('b' | 't' | 'n' | 'f' | 'r' | '"' | '\'' | '\\' | '0' .. '3' '0' .. '7' '0' .. '7' | '0' .. '7' '0' .. '7' | '0' .. '7')
;

FLOATLITERAL
: ('0' .. '9')+ '.' ('0' .. '9')* Exponent?
| '.' ('0' .. '9')+ Exponent?
| ('0' .. '9')+ Exponent
;

fragment Exponent
: 'E' ('+' | '-')? ('0' .. '9')+
;

INTLITERAL
: ('0' .. '9')+
| HexPrefix HexDigit+ HexSuffix
| BinPrefix BinDigit+ BinSuffix
;

fragment HexPrefix
: '\'' 'H'
;

fragment HexDigit
: '0' .. '9'
| 'A' .. 'F'
;

fragment HexSuffix
: '\''
;

fragment BinPrefix
: '\'' 'B'
;

fragment BinDigit
: '0'
| '1'
;

fragment BinSuffix
: '\''
;

IDENTIFIER
: IdentifierStart IdentifierPart*
;

fragment IdentifierStart
: 'A' .. 'Z'
| '_'
;

fragment IdentifierPart
: IdentifierStart
| '0' .. '9'
;

Loading
Loading