Skip to content

Commit d26116b

Browse files
committed
Fix TypeScript syntax accidentally left in ECMAScript.lexh
1 parent 0397acd commit d26116b

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

opengrok-indexer/src/main/resources/analysis/javascript/ECMAScript.lexh

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,13 @@
2929
*/
3030
Identifier = [\p{XID_Start}_$] [\p{XID_Continue}$\u{200C}\u{200D}]*
3131

32-
/*
33-
* TypeScript 2.7 added support for numeric separators.
34-
*/
3532
NumericLiteral = ({DecimalLiteral} | {BinaryIntegerLiteral} |
3633
{OctalIntegerLiteral} | {HexIntegerLiteral})
3734

3835
DecimalLiteral = ({DecimalIntegerLiteral} "." {ExponentPart}? |
3936
{DecimalIntegerLiteral} "." {DecimalDigits} {ExponentPart}? |
4037
"." {DecimalDigits} {ExponentPart}? |
41-
{DecimalIntegerLiteral} ({ExponentPart} | {BigIntSuffix})?)
38+
{DecimalIntegerLiteral} {ExponentPart}?)
4239
/*
4340
* OpenGrok relaxes from the strict ECMA definition of
4441
* DecimalIntegerLiteral::
@@ -48,29 +45,23 @@ DecimalLiteral = ({DecimalIntegerLiteral} "." {ExponentPart}? |
4845
* NonOctalDecimalIntegerLiteral, or LegacyOctalLikeDecimalIntegerLiteral.
4946
*/
5047
DecimalIntegerLiteral = {DecimalDigits}
51-
DecimalDigits = ({DecimalDigit} |
52-
{DecimalDigit} {NumericLiteralSeparator} {DecimalDigit})+
48+
DecimalDigits = {DecimalDigit}+
5349
DecimalDigit = [0123456789]
5450
// NonZeroDigit = [123456789]
5551
ExponentPart = {ExponentIndicator} {SignedInteger}
5652
ExponentIndicator = [eE]
5753
SignedInteger = ({DecimalDigits} | "+" {DecimalDigits} | "-" {DecimalDigits})
58-
NumericLiteralSeparator = "_" // version 2.7
59-
BigIntSuffix = "n" // version 3.2
6054

6155
BinaryIntegerLiteral = "0" [bB] {BinaryDigits}
62-
BinaryDigits = ({BinaryDigit} |
63-
{BinaryDigit} {NumericLiteralSeparator} {BinaryDigit})+
56+
BinaryDigits = {BinaryDigit}+
6457
BinaryDigit = [01]
6558

6659
OctalIntegerLiteral = "0" [oO] {OctalDigits}
67-
OctalDigits = ({OctalDigit} |
68-
{OctalDigit} {NumericLiteralSeparator} {OctalDigit})+
60+
OctalDigits = {OctalDigit}+
6961
OctalDigit = [01234567]
7062

7163
HexIntegerLiteral = "0" [xX] {HexDigits}
72-
HexDigits = ({HexDigit} |
73-
{HexDigit} {NumericLiteralSeparator} {HexDigit})+
64+
HexDigits = {HexDigit}+
7465
HexDigit = [0123456789abcdefABCDEF]
7566

7667
File = [a-zA-Z]{FNameChar}* "." ([Js][Ss] |

opengrok-indexer/src/main/resources/analysis/typescript/TypeScript.lexh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ HexDigits = ({HexDigit} |
3535
{HexDigit} {NumericLiteralSeparator} {HexDigit})+
3636
NumericLiteralSeparator = "_"
3737

38+
/*
39+
* TypeScript 3.2 added support for a bigint suffix.
40+
*/
41+
DecimalLiteral = ({DecimalIntegerLiteral} "." {ExponentPart}? |
42+
{DecimalIntegerLiteral} "." {DecimalDigits} {ExponentPart}? |
43+
"." {DecimalDigits} {ExponentPart}? |
44+
{DecimalIntegerLiteral} ({ExponentPart} | {BigIntSuffix})?)
45+
BigIntSuffix = "n" // version 3.2
46+
3847
File = [a-zA-Z]{FNameChar}* "." ([Jj][Ss] | [Tt][Ss][Xx]? |
3948
[Pp][Rr][Oo][Pp][Ee][Rr][Tt][Ii][Ee][Ss] | [Pp][Rr][Oo][Pp][Ss] |
4049
[Xx][Mm][Ll] | [Cc][Oo][Nn][Ff] | [Tt][Xx][Tt] | [Hh][Tt][Mm][Ll]? |

opengrok-indexer/src/main/resources/analysis/typescript/TypeScriptSymbolTokenizer.lex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,11 @@ import java.io.IOException;
121121
%include Common.lexh
122122
%include CommonURI.lexh
123123
%include CommonPath.lexh
124-
%include TypeScript.lexh
125124
%include ECMAScript.lexh
125+
// TypeScript.lexh comes after ECMAScript so that TypeScript macros supersede.
126+
%include TypeScript.lexh
126127

127128
%%
129+
// TypeScriptProductions.lexh comes first so that its expressions are preferred.
128130
%include TypeScriptProductions.lexh
129131
%include ECMAScriptProductions.lexh

opengrok-indexer/src/main/resources/analysis/typescript/TypeScriptXref.lex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ import java.util.Set;
102102
%include Common.lexh
103103
%include CommonURI.lexh
104104
%include CommonPath.lexh
105+
// TypeScript.lexh comes after ECMAScript so that TypeScript macros supersede.
105106
%include ECMAScript.lexh
106107
%include TypeScript.lexh
107108

108109
%%
110+
// TypeScriptProductions.lexh comes first so that its expressions are preferred.
109111
%include TypeScriptProductions.lexh
110112
%include ECMAScriptProductions.lexh

0 commit comments

Comments
 (0)