https://github.com/antlr/grammars-v4
Revision 3ba0d9b93824e1185103829008e317d6a68aa628 authored by dependabot[bot] on 03 March 2024, 01:33:37 UTC, committed by GitHub on 03 March 2024, 01:33:37 UTC
Bumps [trxgrep](https://github.com/kaby76/Domemtech.Trash) from 0.21.16 to 0.22.0.
- [Commits](https://github.com/kaby76/Domemtech.Trash/commits)

---
updated-dependencies:
- dependency-name: trxgrep
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent ab9ab66
Raw File
Tip revision: 3ba0d9b93824e1185103829008e317d6a68aa628 authored by dependabot[bot] on 03 March 2024, 01:33:37 UTC
Bump trxgrep from 0.21.16 to 0.22.0 (#3990)
Tip revision: 3ba0d9b
WrenLexer.g4
/*
 [The "BSD licence"]
 Copyright (c) 2022 Boris Zhguchev
 All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
 are met:
 1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
 2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
 3. The name of the author may not be used to endorse or promote products
    derived from this software without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// $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 WrenLexer;

AS         : 'as';
BREAK_T    : 'break';
CLASS_T    : 'class';
CONSTRUCT  : 'construct';
CONTINUE_T : 'continue';
ELSE_T     : 'else';
FALSE_T    : 'false';
FOR_T      : 'for';
FOREIGN_T  : 'foreign';
IF_T       : 'if';
IMPORT_T   : 'import';
IN         : 'in';
IS         : 'is';
NULL_T     : 'null';
RETURN_T   : 'return';
STATIC_T   : 'static';
TRUE_T     : 'true';
VAR_T      : 'var';
WHILE_T    : 'while';

LPAREN : '(';
RPAREN : ')';
LBRACE : '{';
RBRACE : '}';
LBRACK : '[';
RBRACK : ']';
SEMI   : ';';
COMMA  : ',';
DOT    : '.';

HASH           : '#';
GT             : '>';
LT             : '<';
BANG           : '!';
TILDE          : '~';
QUESTION       : '?';
COLON          : ':';
EQUAL          : '==';
LE             : '<=';
GE             : '>=';
NOTEQUAL       : '!=';
AND            : '&&';
OR             : '||';
INC            : '++';
DEC            : '--';
ADD            : '+';
SUB            : '-';
MUL            : '*';
DIV            : '/';
BITAND         : '&';
BITOR          : '|';
CARET          : '^';
MOD            : '%';
ASSIGN         : '=';
ADD_ASSIGN     : '+=';
SUB_ASSIGN     : '-=';
MUL_ASSIGN     : '*=';
DIV_ASSIGN     : '/=';
AND_ASSIGN     : '&=';
OR_ASSIGN      : '|=';
XOR_ASSIGN     : '^=';
MOD_ASSIGN     : '%=';
LSHIFT_ASSIGN  : '<<=';
LSHIFT         : '<<';
RSHIFT         : '>>';
RSHIFT_ASSIGN  : '>>=';
URSHIFT_ASSIGN : '>>>=';
ELLIPSIS_OUT   : '...';
ELLIPSIS_IN    : '..';

IDENTIFIER: Letter LetterOrDigit*;

DECIMAL_LITERAL : SUB? ('0' | [1-9] (Digits? | '_'+ Digits));
HEX_LITERAL     : '0' [xX] [0-9a-fA-F] ([0-9a-fA-F_]* [0-9a-fA-F])?;
OCT_LITERAL     : '0' '_'* [0-7] ([0-7_]* [0-7])? [lL]?;
BINARY_LITERAL  : '0' [bB] [01] ([01_]* [01])? [lL]?;

FLOAT_LITERAL:
    SUB? (Digits '.' Digits | '.' Digits) ExponentPart? [fFdD]?
    | SUB? Digits (ExponentPart [fFdD]? | [fFdD])
;

HEX_FLOAT_LITERAL: '0' [xX] (HexDigits '.'? | HexDigits? '.' HexDigits) [pP] [+-]? Digits [fFdD]?;

CHAR_LITERAL: '\'' (~['\\\r\n] | EscapeSequence) '\'';

STRING_LITERAL : '"' (~["\\\r\n] | EscapeSequence)* '"';
TEXT_BLOCK     : '"""' [ \t]* [\r\n] (. | EscapeSequence)*? '"""';

fragment EscapeSequence:
    '\\' [btnfr"'\\]
    | '\\' ([0-3]? [0-7])? [0-7]
    | '\\' 'u'+ HexDigit HexDigit HexDigit HexDigit
;

WS           : [ \t\r\n\u000C]+ -> channel(HIDDEN);
COMMENT      : '/*' .*? '*/'    -> channel(2);
LINE_COMMENT : '//' ~[\r\n]*    -> channel(2);
ERRCHAR      : .                -> channel(HIDDEN);

fragment ExponentPart: [eE] [+-]? Digits;

fragment HexDigits : HexDigit ((HexDigit | '_')* HexDigit)?;
fragment HexDigit  : [0-9a-fA-F];
fragment Digits    : [0-9] ([0-9_]* [0-9])?;

fragment LetterOrDigit: Letter | [0-9];

fragment Letter:
    [a-zA-Z_]
    | ~[\u0000-\u007F\uD800-\uDBFF] // covers all characters above 0x7F which are not a surrogate
    | [\uD800-\uDBFF] [\uDC00-\uDFFF]
; // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
back to top