Skip to content

Commit

Permalink
build: update grammer file for Java 17 #29
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 8, 2022
1 parent 54e0ebd commit 15f3c91
Show file tree
Hide file tree
Showing 2 changed files with 214 additions and 52 deletions.
32 changes: 31 additions & 1 deletion languages/g4/JavaLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
[The "BSD licence"]
Copyright (c) 2013 Terence Parr, Sam Harwell
Copyright (c) 2017 Ivan Kochurkin (upgrade to Java 8)
Copyright (c) 2021 Michał Lorek (upgrade to Java 11)
Copyright (c) 2022 Michał Lorek (upgrade to Java 17)
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -82,13 +84,39 @@ VOID: 'void';
VOLATILE: 'volatile';
WHILE: 'while';

// Module related keywords
MODULE: 'module';
OPEN: 'open';
REQUIRES: 'requires';
EXPORTS: 'exports';
OPENS: 'opens';
TO: 'to';
USES: 'uses';
PROVIDES: 'provides';
WITH: 'with';
TRANSITIVE: 'transitive';

// Local Variable Type Inference
VAR: 'var'; // reserved type name

// Switch Expressions
YIELD: 'yield';

// Records
RECORD: 'record';

// Sealed Classes
SEALED: 'sealed';
PERMITS: 'permits';
NON_SEALED: 'non-sealed';

// Literals

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

FLOAT_LITERAL: (Digits '.' Digits? | '.' Digits) ExponentPart? [fFdD]?
| Digits (ExponentPart [fFdD]? | [fFdD])
;
Expand All @@ -103,6 +131,8 @@ CHAR_LITERAL: '\'' (~['\\\r\n] | EscapeSequence) '\'';

STRING_LITERAL: '"' (~["\\\r\n] | EscapeSequence)* '"';
TEXT_BLOCK: '"""' [ \t]* [\r\n] (. | EscapeSequence)*? '"""';
NULL_LITERAL: 'null';
// Separators
Expand Down
Loading

0 comments on commit 15f3c91

Please sign in to comment.