From 9b60676942dd5f0402945de9e8ab30a5da8d4257 Mon Sep 17 00:00:00 2001 From: jansorg Date: Tue, 16 Feb 2021 10:10:22 +0100 Subject: [PATCH] Fixes to lexer, parser, highlighting settings, file type icon --- README.md | 49 +- src/grammar/cue.bnf | 54 +- src/grammar/cue.flex | 68 ++- .../dev/monogon/cue/lang/CueTypes.java | 14 +- .../dev/monogon/cue/lang/lexer/_CueLexer.java | 478 +++++++++--------- .../monogon/cue/lang/parser/CueParser.java | 201 +++++--- .../monogon/cue/lang/psi/CueAttribute.java | 2 +- .../monogon/cue/lang/psi/CueDeclaration.java | 3 + .../dev/monogon/cue/lang/psi/CueEllipsis.java | 2 +- .../dev/monogon/cue/lang/psi/CueIndex.java | 2 +- .../dev/monogon/cue/lang/psi/CueVisitor.java | 2 +- .../cue/lang/psi/impl/CueAttributeImpl.java | 4 +- .../cue/lang/psi/impl/CueDeclarationImpl.java | 6 + .../cue/lang/psi/impl/CueEllipsisImpl.java | 4 +- .../cue/lang/psi/impl/CueIndexImpl.java | 4 +- src/main/java/dev/monogon/cue/Icons.java | 5 + .../dev/monogon/cue/lang/CueFileType.java | 3 +- .../dev/monogon/cue/lang/CueTokenTypes.java | 11 +- .../highlighter/CueHighlightingColors.java | 10 +- .../highlighter/CueSyntaxHighlighter.java | 10 + .../cue/lang/parser/CueParserUtil.java | 19 + .../dev/monogon/cue/lang/psi/CueFile.java | 3 + src/main/resources/icons/cue_logo.svg | 148 ++++++ .../cue/inserting_lexer/struct_single.cue | 1 + .../cue/inserting_lexer/struct_single.txt | 7 + src/test/data/lang/cue/lexer/bottom.cue | 1 + src/test/data/lang/cue/lexer/bottom.txt | 5 + src/test/data/lang/cue/lexer/ellipsis.cue | 1 + src/test/data/lang/cue/lexer/ellipsis.txt | 24 + .../cue/lexer/{keywords.cue => keywords1.cue} | 0 .../cue/lexer/{keywords.txt => keywords1.txt} | 0 src/test/data/lang/cue/lexer/keywords2.cue | 4 + src/test/data/lang/cue/lexer/keywords2.txt | 17 + src/test/data/lang/cue/lexer/operators.txt | 6 +- src/test/data/lang/cue/lexer/struct_int.cue | 1 + src/test/data/lang/cue/lexer/struct_int.txt | 6 + src/test/data/lang/cue/lexer/top.cue | 1 + src/test/data/lang/cue/lexer/top.txt | 6 + src/test/data/lang/cue/parser/ellipsis.cue | 2 + src/test/data/lang/cue/parser/ellipsis.txt | 52 ++ src/test/data/lang/cue/parser/struct7.cue | 4 + src/test/data/lang/cue/parser/struct7.txt | 29 ++ src/test/data/lang/cue/parser/struct8.cue | 1 + src/test/data/lang/cue/parser/struct8.txt | 40 ++ src/test/data/lang/cue/parser/struct_int.cue | 1 + src/test/data/lang/cue/parser/struct_int.txt | 13 + 46 files changed, 914 insertions(+), 410 deletions(-) create mode 100644 src/main/resources/icons/cue_logo.svg create mode 100644 src/test/data/lang/cue/inserting_lexer/struct_single.cue create mode 100644 src/test/data/lang/cue/inserting_lexer/struct_single.txt create mode 100644 src/test/data/lang/cue/lexer/bottom.cue create mode 100644 src/test/data/lang/cue/lexer/bottom.txt create mode 100644 src/test/data/lang/cue/lexer/ellipsis.cue create mode 100644 src/test/data/lang/cue/lexer/ellipsis.txt rename src/test/data/lang/cue/lexer/{keywords.cue => keywords1.cue} (100%) rename src/test/data/lang/cue/lexer/{keywords.txt => keywords1.txt} (100%) create mode 100644 src/test/data/lang/cue/lexer/keywords2.cue create mode 100644 src/test/data/lang/cue/lexer/keywords2.txt create mode 100644 src/test/data/lang/cue/lexer/struct_int.cue create mode 100644 src/test/data/lang/cue/lexer/struct_int.txt create mode 100644 src/test/data/lang/cue/lexer/top.cue create mode 100644 src/test/data/lang/cue/lexer/top.txt create mode 100644 src/test/data/lang/cue/parser/ellipsis.cue create mode 100644 src/test/data/lang/cue/parser/ellipsis.txt create mode 100644 src/test/data/lang/cue/parser/struct7.cue create mode 100644 src/test/data/lang/cue/parser/struct7.txt create mode 100644 src/test/data/lang/cue/parser/struct8.cue create mode 100644 src/test/data/lang/cue/parser/struct8.txt create mode 100644 src/test/data/lang/cue/parser/struct_int.cue create mode 100644 src/test/data/lang/cue/parser/struct_int.txt diff --git a/README.md b/README.md index 09d0463..cc261fd 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,23 @@ **CUE Language** support for the IntelliJ platform. +## Usage +The CUE plugin is compatible with **any JetBrains IDE 2020.3**. Only IntelliJ-based IDEs are supported, i.e. it's incompatible with ReSharper. + +### Features +**Please note that this plugin is still in a very early state.** +- Parsing +- Basic syntax highlighting + +### Bug Reports & Feature Requests +Please report your issues at [github.com/nexantic/intellij-cue](https://github.com/nexantic/intellij-cue). + ## Development + +- Java JDK 11 is required + ### IDE + Development is best in IntelliJ IDEA. The following plugins are required for development: @@ -12,18 +27,46 @@ The following plugins are required for development: - Gradle - Kotlin, for Gradle build file support +### Building + +After a build, the plugin is available as a ZIP file at `build/districutions/`. + +Building with tests: + +```bash +./gradlew clean build +``` + +Building without tests: + +```bash +./gradlew clean build -x test +``` + +### Executing + +You could build the plugin (see above) and install it into your IDE of choice. Alternatively, you can run the plugin in a sandbox: + +```bash +./gradlew runIde +``` + ### Lexer + The lexer is generated by JFlex. The definition is at `src/grammar/cue.flex`. The following command regenerates the lexer: + ```bash ./gradlew generateLexer ``` + ### Parser -The parser is generated with JetBrains' GrammarKit. GrammarKit is a plugin for IntelliJ IDEA. -The definition is at `src/grammar/cue.bnf`. -To update the parser and all related classes, open the `cue.bnf` file in your IDE and choose `Generate Parser` in the context menu of the editor. +The parser is generated with JetBrains' GrammarKit. GrammarKit is a plugin for IntelliJ IDEA. The definition is at `src/grammar/cue.bnf`. + +To update the parser and all related classes, open the `cue.bnf` file in your IDE and choose `Generate Parser` in the context menu of the +editor. ## Useful Link diff --git a/src/grammar/cue.bnf b/src/grammar/cue.bnf index 93406d9..be75b1c 100644 --- a/src/grammar/cue.bnf +++ b/src/grammar/cue.bnf @@ -5,13 +5,12 @@ Please not the following important differences: - CUE has ":" to start a rule, GrammarKit has "::=" - in CUE's grammar {a} means 0 or more "a", but in GrammarKit {} it's just a grouping element. GrammarKit's most-similar equivalent: {}* -- GrammarKit doesn't support left-recursive rules +- GrammarKit doesn't support left-recursive rules without adjustment to the type hierarchy */ { - generate=[java="8"] + generate=[java="11"] consumeTokenMethod(".*")="consumeTokenFast" - generateTokenAccessors=false parserClass="dev.monogon.cue.lang.parser.CueParser" parserUtilClass="dev.monogon.cue.lang.parser.CueParserUtil" @@ -42,12 +41,16 @@ Please not the following important differences: REL_OP = "REL_OP" ADD_OP = "ADD_OP" MUL_OP = "MUL_OP" - PIPE = "|" - AMP = "&" - PIPE_PIPE = "||" - AMP_AMP = "&&" - EQ_EQ = "==" - OPERATOR = "OPERATOR" + OP_DISJUNCTION = "|" + OP_UNIFICATION = "&" + OP_OR = "||" + OP_AND = "&&" + OP_EQ = "==" + + QMARK = "?" + EXCL = "!" + DOT = "." + BOTTOM = "_|_" // we're using _END tokens for string terminating tokens, // because CueCommaInsertingLexer needs to know where string literals end @@ -105,16 +108,17 @@ private string_lit ::= simple_string_lit | "#" string_lit "#" // https://cuelang.org/docs/references/spec/#structs -StructLit ::= "{" { Declaration "," }* "}" {extends=Literal} +// fixme change of grammar rules +StructLit ::= "{" [ Declaration {"," Declaration}* ","? ] "}" {extends=Literal pin=1} Declaration ::= Field | Ellipsis | Embedding | LetClause | attribute -Ellipsis ::= "..." [ Expression ] {extends=Declaration} +Ellipsis ::= "..." [ Expression ] // use by both Declaration and ListLit Embedding ::= Comprehension | AliasExpr {extends=Declaration} Field ::= Label ":" { Label ":" }* Expression { attribute }* {extends=Declaration} Label ::= [ IDENTIFIER "=" ] LabelExpr -LabelExpr ::= LabelName [ "?" ] | "[" AliasExpr "]" -private LabelName ::= IDENTIFIER | simple_string_lit +LabelExpr ::= LabelName ["?"] | "[" AliasExpr "]" +private LabelName ::= <> | simple_string_lit -attribute ::= "@" IDENTIFIER "(" attr_tokens ")" +attribute ::= "@" IDENTIFIER "(" attr_tokens ")" {pin=1} attr_tokens ::= { <> // fixme psi element for attr_token? | "(" attr_tokens ")" | "[" attr_tokens "]" @@ -125,7 +129,8 @@ attr_tokens ::= { <> // fixme psi element for attr_token? AliasExpr ::= Expression | IDENTIFIER "=" Expression { extends=Expression } // fixme added closing ] at the end, bug in grammar -ListLit ::= "[" [ ElementList [ "," [ Ellipsis ] ] [ "," ] ] "]" {extends=Literal} +ListLit ::= "[" [ListLitInner | Ellipsis] "]" {extends=Literal pin=1} +private ListLitInner ::= ElementList ["," Ellipsis] [","] ElementList ::= Embedding { "," Embedding }* // https://cuelang.org/docs/references/spec/#expressions @@ -142,9 +147,9 @@ QualifiedIdent ::= PackageName "." IDENTIFIER {extends=Operand} PrimaryExpr ::= Operand {Selector | Index | Slice | Arguments}* {extends=Expression} Selector ::= "." (IDENTIFIER | simple_string_lit) {extends=PrimaryExpr} -Index ::= "[" Expression "]" {extends=PrimaryExpr} +Index ::= "[" Expression "]" {extends=PrimaryExpr pin=1} Argument ::= Expression {extends=PrimaryExpr} -Arguments ::= "(" [ ( Argument { "," Argument }* ) [ "," ] ] ")" {extends=PrimaryExpr} +Arguments ::= "(" [ ( Argument { "," Argument }* ) [ "," ] ] ")" {extends=PrimaryExpr pin=1} // fixme Slice is missing // https://cuelang.org/docs/references/spec/#operators @@ -152,11 +157,16 @@ Expression ::= UnaryExpr | BinaryExpr // fixme extra root? UnaryExpr ::= PrimaryExpr | unary_op UnaryExpr { extends=Expression } BinaryExpr ::= Expression binary_op Expression { extends=Expression } -private binary_op ::= PIPE | AMP | PIPE_PIPE | AMP_AMP | EQ_EQ | rel_op | add_op | mul_op //"|" | "&" | "||" | "&&" | "==" | rel_op | add_op | mul_op -private rel_op ::= REL_OP //"!=" | "<" | "<=" | ">" | ">=" | "=~" | "!~" -private add_op ::= ADD_OP //"+" | "-" -private mul_op ::= MUL_OP //"*" | "/" | "div" | "mod" | "quo" | "rem" -private unary_op ::= ADD_OP | "!" | "*" | rel_op // "+" | "-" | "!" | "*" | rel_op +//"|" | "&" | "||" | "&&" | "==" | rel_op | add_op | mul_op +private binary_op ::= OP_DISJUNCTION | OP_UNIFICATION | OP_OR | OP_AND | OP_EQ | rel_op | add_op | mul_op +//"!=" | "<" | "<=" | ">" | ">=" | "=~" | "!~" +private rel_op ::= REL_OP +//"+" | "-" +private add_op ::= ADD_OP +//"*" | "/" | "div" | "mod" | "quo" | "rem" +private mul_op ::= MUL_OP +// "+" | "-" | "!" | "*" | rel_op +private unary_op ::= ADD_OP | EXCL | "*" | rel_op // https://cuelang.org/docs/references/spec/#comprehensions Comprehension ::= Clauses StructLit diff --git a/src/grammar/cue.flex b/src/grammar/cue.flex index eb3b36e..f4077a3 100644 --- a/src/grammar/cue.flex +++ b/src/grammar/cue.flex @@ -48,9 +48,10 @@ import static dev.monogon.cue.lang.CueTokenTypes.*; %type IElementType // White space, formed from spaces (U+0020), horizontal tabs (U+0009), carriage returns (U+000D), and newlines (U+000A) -// IntelliJ: tokenizing newlines, which are whitespace, as separate tokens to simplify out CueCommaInsertingLexer +// IntelliJ: tokenizing newlines, which are whitespace, as separate tokens to simplify our CueCommaInsertingLexer WHITE_SPACE=[ \t\r] WHITE_SPACE_NEWLINE=[\n] +WHITE_SPACE_ANY=[ \t\r\n] // https://cuelang.org/docs/references/spec/#characters newline = \n /* the Unicode code point U+000A */ @@ -75,7 +76,7 @@ identifier = ("#" | "_#")? {letter} {letter_digit}* // https://cuelang.org/docs/references/spec/#letters-and-digits decimal_lit = [1-9] ("_"? {decimal_digit})* decimals = {decimal_digit} ("_"? {decimal_digit})* -si_lit = {decimals} ("." {decimals})? {multiplier} +si_lit = {decimals} ("." {decimals})? {multiplier} | "." {decimals} {multiplier} binary_lit = "0b" {binary_digit} ("_"? {binary_digit})* hex_lit = "0" [xX] {hex_digit} ("_"? {hex_digit})* @@ -89,23 +90,6 @@ float_lit = {decimals} "." {decimals}? {exponent}? | "." {decimals} {exponent}? exponent = [eE] [+-]? {decimals} -// https://cuelang.org/docs/references/spec/#null -null_lit = "null" - -// fixme undefined in spec -bool_lit = "true" | "false" - -// https://cuelang.org/docs/references/spec/#keywords -keyword_preamble = "package" | "import" -keyword_comprehensions = "for" | "in" | "if" | "let" -//keyword_arithmetic = "div" | "mod" | "quo" | "rem" - -// https://cuelang.org/docs/references/spec/#operators-and-punctuation -// most operators are matched below -operators = "?" | "!" - | "_|_" - | "." - // https://cuelang.org/docs/references/spec/#string-and-byte-sequence-literals escaped_char = "\\" "#"* [abfnrtv/\\'\"] byte_value = {octal_byte_value} | {hex_byte_value} @@ -153,14 +137,15 @@ interpolation_end = ")" } { - {keyword_preamble} | - {keyword_comprehensions} - { return KEYWORD; } // for now, a single token + "package" | "import" + | "for" | "in" | "if" | "let" + { return KEYWORD; } // for now, one token for all, https://cuelang.org/docs/references/spec/#keywords + "null" { return NULL_LIT; } // https://cuelang.org/docs/references/spec/#null + "true" | "false" { return BOOL_LIT; } // fixme currently undefined in spec - {null_lit} { return NULL_LIT; } - {bool_lit} { return BOOL_LIT; } + "_|_" { return BOTTOM; } -// operator tokens + // operator tokens "{" { return LEFT_CURLY; } "}" { return RIGHT_CURLY; } ":" { return COLON; } @@ -168,9 +153,9 @@ interpolation_end = ")" "," { return COMMA; } "=" { return EQ; } "?" { return QMARK; } + "@" { return AT; } "[" { return LEFT_BRACKET; } "]" { return RIGHT_BRACKET; } - "@" { return AT; } "(" { return LEFT_PAREN; } ")" { return RIGHT_PAREN; } @@ -180,31 +165,36 @@ interpolation_end = ")" { return ADD_OP; } "*" | "/" | "div" | "mod" | "quo" | "rem" { return MUL_OP; } - "|" { return PIPE; } - "&" { return AMP; } - "||" { return PIPE_PIPE; } - "&&" { return AMP_AMP; } - "==" { return EQ_EQ; } - {operators} { return OPERATOR; } // for now, a single token -// end of operators + "|" { return OP_DISJUNCTION; } + "&" { return OP_UNIFICATION; } + "||" { return OP_OR; } + "&&" { return OP_AND; } + "==" { return OP_EQ; } + // end of operators + + "?" { return QMARK; } + "!" { return EXCL; } + "." { return DOT; } + {identifier} { return IDENTIFIER; } {float_lit} { return FLOAT_LIT; } {decimal_lit} - | {si_lit} - | {octal_lit} - | {binary_lit} - | {hex_lit} { return INT_LIT; } + | {si_lit} + | {octal_lit} + | {binary_lit} + | {hex_lit} { return INT_LIT; } + "0" // fixme temporary change, "0" seems to be missing in the lang spec + { return INT_LIT; } "\"" { pushState(STRING_LITERAL); return DOUBLE_QUOTE; } - "'" { pushState(BYTE_LITERAL); return SINGLE_QUOTE; } "\"\"\"" / {newline} { pushState(STRING_MULTILINE); return MULTILINE_STRING_START; } + "'" { pushState(BYTE_LITERAL); return SINGLE_QUOTE; } "'''" / {newline} { pushState(BYTES_MULTILINE); return MULTILINE_BYTES_START; } "//" {unicode_char}* { return COMMENT; } } -// all states {WHITE_SPACE_NEWLINE} { return WHITE_SPACE_NEWLINE; } {WHITE_SPACE} { return WHITE_SPACE; } [^] { return BAD_CHARACTER; } diff --git a/src/main/java-gen/dev/monogon/cue/lang/CueTypes.java b/src/main/java-gen/dev/monogon/cue/lang/CueTypes.java index defdbcf..1e5f5b0 100644 --- a/src/main/java-gen/dev/monogon/cue/lang/CueTypes.java +++ b/src/main/java-gen/dev/monogon/cue/lang/CueTypes.java @@ -53,19 +53,19 @@ public interface CueTypes { IElementType UNARY_EXPR = new CueCompositeElementType("UNARY_EXPR"); IElementType ADD_OP = new CueTokenType("ADD_OP"); - IElementType AMP = new CueTokenType("&"); - IElementType AMP_AMP = new CueTokenType("&&"); IElementType AT = new CueTokenType("@"); IElementType BOOL_LIT = new CueTokenType("BOOL_LIT"); + IElementType BOTTOM = new CueTokenType("_|_"); IElementType BOTTOM_LIT = new CueTokenType("BOTTOM_LIT"); IElementType BYTE_VALUE = new CueTokenType("BYTE_VALUE"); IElementType COLON = new CueTokenType(":"); IElementType COMMA = new CueTokenType(","); + IElementType DOT = new CueTokenType("."); IElementType DOUBLE_QUOTE = new CueTokenType("DOUBLE_QUOTE"); IElementType DOUBLE_QUOTE_END = new CueTokenType("DOUBLE_QUOTE_END"); IElementType ELLIPSIS_TOKEN = new CueTokenType("..."); IElementType EQ = new CueTokenType("="); - IElementType EQ_EQ = new CueTokenType("=="); + IElementType EXCL = new CueTokenType("!"); IElementType FLOAT_LIT = new CueTokenType("FLOAT_LIT"); IElementType IDENTIFIER = new CueTokenType("IDENTIFIER"); IElementType INTERPOLATION_END = new CueTokenType("INTERPOLATION_END"); @@ -82,9 +82,11 @@ public interface CueTypes { IElementType MUL_OP = new CueTokenType("MUL_OP"); IElementType NEWLINE = new CueTokenType("\\n"); IElementType NULL_LIT = new CueTokenType("NULL_LIT"); - IElementType OPERATOR = new CueTokenType("OPERATOR"); - IElementType PIPE = new CueTokenType("|"); - IElementType PIPE_PIPE = new CueTokenType("||"); + IElementType OP_AND = new CueTokenType("&&"); + IElementType OP_DISJUNCTION = new CueTokenType("|"); + IElementType OP_EQ = new CueTokenType("=="); + IElementType OP_OR = new CueTokenType("||"); + IElementType OP_UNIFICATION = new CueTokenType("&"); IElementType QMARK = new CueTokenType("?"); IElementType REL_OP = new CueTokenType("REL_OP"); IElementType RIGHT_BRACKET = new CueTokenType("]"); diff --git a/src/main/java-gen/dev/monogon/cue/lang/lexer/_CueLexer.java b/src/main/java-gen/dev/monogon/cue/lang/lexer/_CueLexer.java index 57889be..ee3b383 100644 --- a/src/main/java-gen/dev/monogon/cue/lang/lexer/_CueLexer.java +++ b/src/main/java-gen/dev/monogon/cue/lang/lexer/_CueLexer.java @@ -121,12 +121,12 @@ public static int ZZ_CMAP(int ch) { /* The ZZ_CMAP_A table has 3104 entries */ static final char ZZ_CMAP_A[] = zzUnpackCMap( - "\11\0\1\1\1\2\2\0\1\1\22\0\1\1\1\44\1\55\1\13\2\0\1\73\1\56\1\53\1\54\1\70"+ - "\1\24\1\12\1\24\1\15\1\47\1\11\1\14\6\7\2\6\1\61\1\0\1\66\1\62\1\66\1\43\1"+ - "\65\4\10\1\23\1\10\1\21\3\3\1\21\1\3\1\21\2\3\1\21\3\3\1\21\1\52\2\3\1\17"+ - "\2\3\1\63\1\46\1\64\1\0\1\5\1\0\1\34\1\16\1\37\1\71\1\32\1\33\1\41\1\3\1\22"+ - "\1\3\1\40\1\27\1\42\1\25\1\20\1\36\1\72\1\31\1\35\1\30\1\26\1\50\1\3\1\51"+ - "\2\3\1\57\1\45\1\60\1\67\13\0\1\3\12\0\1\3\4\0\1\3\5\0\27\3\1\0\12\3\4\0\14"+ + "\11\0\1\1\1\2\2\0\1\1\22\0\1\1\1\65\1\36\1\13\2\0\1\73\1\37\1\34\1\35\1\70"+ + "\1\24\1\12\1\24\1\15\1\26\1\11\1\14\6\7\2\6\1\57\1\0\1\66\1\60\1\66\1\61\1"+ + "\62\4\10\1\23\1\10\1\21\3\3\1\21\1\3\1\21\2\3\1\21\3\3\1\21\1\33\2\3\1\17"+ + "\2\3\1\63\1\25\1\64\1\0\1\5\1\0\1\41\1\16\1\42\1\71\1\45\1\30\1\44\1\3\1\22"+ + "\1\3\1\43\1\52\1\46\1\51\1\20\1\40\1\72\1\47\1\53\1\50\1\32\1\27\1\3\1\31"+ + "\2\3\1\55\1\54\1\56\1\67\13\0\1\3\12\0\1\3\4\0\1\3\5\0\27\3\1\0\12\3\4\0\14"+ "\3\16\0\5\3\7\0\1\3\1\0\1\3\1\0\5\3\1\0\2\3\2\0\4\3\1\0\1\3\6\0\1\3\1\0\3"+ "\3\1\0\1\3\1\0\4\3\1\0\23\3\1\0\13\3\10\0\6\3\1\0\26\3\2\0\1\3\6\0\10\3\10"+ "\0\13\3\5\0\3\3\15\0\12\4\4\0\6\3\1\0\1\3\17\0\2\3\7\0\2\3\12\4\3\3\2\0\2"+ @@ -173,17 +173,17 @@ public static int ZZ_CMAP(int ch) { private static final int [] ZZ_ACTION = zzUnpackAction(); private static final String ZZ_ACTION_PACKED_0 = - "\6\0\1\1\1\2\1\3\2\4\1\5\1\1\1\6"+ - "\1\1\1\7\1\4\1\10\7\4\1\11\1\7\1\12"+ - "\1\13\1\14\1\15\1\16\1\17\1\20\1\21\1\22"+ - "\1\23\1\24\1\25\1\26\1\27\1\13\2\4\1\30"+ - "\2\31\1\32\1\33\2\31\1\34\1\31\1\35\3\0"+ - "\1\36\1\5\6\0\1\36\1\0\1\37\11\4\1\27"+ - "\1\40\1\41\2\0\1\42\2\4\1\43\3\0\1\44"+ - "\4\0\1\7\1\5\1\36\1\0\3\5\1\0\1\45"+ - "\3\4\1\13\2\4\4\0\1\46\2\0\1\47\1\4"+ - "\1\50\1\51\1\4\1\52\1\53\2\0\1\54\1\4"+ - "\2\0\1\4"; + "\6\0\1\1\1\2\1\3\2\4\2\5\1\6\1\1"+ + "\1\7\1\4\1\10\1\11\1\4\1\12\1\13\1\14"+ + "\1\15\6\4\1\16\1\17\1\20\1\21\1\22\1\23"+ + "\1\24\1\25\1\26\1\27\1\30\1\11\2\4\1\31"+ + "\2\32\1\33\1\34\2\32\1\35\1\32\1\36\3\0"+ + "\1\37\1\5\6\0\1\37\1\0\1\40\1\4\1\41"+ + "\2\4\2\0\6\4\1\42\1\43\1\30\2\4\1\44"+ + "\3\0\1\45\4\0\1\46\1\5\1\37\1\0\3\5"+ + "\1\0\1\47\2\4\2\0\1\4\1\11\2\4\2\0"+ + "\1\50\2\0\1\51\1\4\1\52\1\53\1\4\1\54"+ + "\1\55\2\0\1\56\1\4\2\0\1\4"; private static int [] zzUnpackAction() { int [] result = new int[130]; @@ -213,20 +213,20 @@ private static int zzUnpackAction(String packed, int offset, int [] result) { private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\74\0\170\0\264\0\360\0\u012c\0\u0168\0\u0168"+ "\0\u0168\0\u01a4\0\u01e0\0\u021c\0\u0258\0\u0168\0\u0294\0\u02d0"+ - "\0\u030c\0\u0168\0\u0348\0\u0384\0\u03c0\0\u03fc\0\u0438\0\u0474"+ - "\0\u04b0\0\u0168\0\u04ec\0\u0528\0\u0564\0\u0168\0\u0168\0\u05a0"+ - "\0\u05dc\0\u0168\0\u0168\0\u0168\0\u0618\0\u0168\0\u0168\0\u0168"+ + "\0\u030c\0\u0168\0\u0348\0\u0384\0\u0168\0\u0168\0\u03c0\0\u03fc"+ + "\0\u0438\0\u0474\0\u04b0\0\u04ec\0\u0528\0\u0564\0\u05a0\0\u0168"+ + "\0\u0168\0\u0168\0\u05dc\0\u0168\0\u0168\0\u0168\0\u0168\0\u0618"+ "\0\u0654\0\u0168\0\u0690\0\u06cc\0\u0708\0\u0168\0\u0744\0\u0168"+ "\0\u0168\0\u0780\0\u07bc\0\u0168\0\u07f8\0\u0168\0\u0294\0\u0834"+ "\0\u0870\0\u08ac\0\u08e8\0\u0924\0\u0960\0\u099c\0\u09d8\0\u0a14"+ "\0\u0a50\0\u0a8c\0\u0ac8\0\u01a4\0\u0b04\0\u0b40\0\u0b7c\0\u0bb8"+ - "\0\u0bf4\0\u0c30\0\u0c6c\0\u0ca8\0\u0ce4\0\u0168\0\u0168\0\u0d20"+ - "\0\u0d5c\0\u0d98\0\u0168\0\u0dd4\0\u0e10\0\u0168\0\u0e4c\0\u0e88"+ + "\0\u0bf4\0\u0c30\0\u0c6c\0\u0ca8\0\u0ce4\0\u0d20\0\u0d5c\0\u0d98"+ + "\0\u0168\0\u0168\0\u0168\0\u0dd4\0\u0e10\0\u0168\0\u0e4c\0\u0e88"+ "\0\u0ec4\0\u0168\0\u0f00\0\u0f3c\0\u0f78\0\u0fb4\0\u0168\0\u0168"+ "\0\u0ff0\0\u102c\0\u1068\0\u10a4\0\u10e0\0\u111c\0\u0168\0\u1158"+ - "\0\u1194\0\u11d0\0\u01a4\0\u120c\0\u1248\0\u1284\0\u12c0\0\u12fc"+ - "\0\u1338\0\u0168\0\u1374\0\u13b0\0\u0168\0\u13ec\0\u01a4\0\u01a4"+ - "\0\u1428\0\u0168\0\u0168\0\u1464\0\u14a0\0\u0168\0\u14dc\0\u1518"+ + "\0\u1194\0\u11d0\0\u120c\0\u1248\0\u01a4\0\u1284\0\u12c0\0\u12fc"+ + "\0\u1338\0\u0168\0\u1374\0\u13b0\0\u0168\0\u13ec\0\u0168\0\u0168"+ + "\0\u1428\0\u01a4\0\u01a4\0\u1464\0\u14a0\0\u0168\0\u14dc\0\u1518"+ "\0\u1554\0\u1590"; private static int [] zzUnpackRowMap() { @@ -255,131 +255,133 @@ private static int zzUnpackRowMap(String packed, int offset, int [] result) { private static final String ZZ_TRANS_PACKED_0 = "\1\7\1\10\1\11\1\12\1\7\1\13\2\14\1\12"+ "\1\15\1\16\1\17\1\14\1\20\4\12\1\21\1\12"+ - "\1\22\1\23\1\12\1\24\1\25\1\26\1\12\1\27"+ - "\2\12\1\30\3\12\1\31\1\32\1\33\1\34\1\7"+ - "\1\35\3\12\1\36\1\37\1\40\1\41\1\42\1\43"+ - "\1\44\1\45\1\46\1\47\1\50\1\51\1\7\1\52"+ - "\1\53\1\54\1\55\2\56\1\11\43\56\1\57\6\56"+ - "\1\60\20\56\1\61\43\56\1\57\6\56\1\62\20\56"+ - "\1\11\43\56\1\63\7\56\1\64\17\56\1\61\43\56"+ - "\1\57\7\56\1\65\15\56\1\7\1\10\1\11\1\12"+ - "\1\7\1\13\2\14\1\12\1\15\1\16\1\17\1\14"+ - "\1\20\4\12\1\21\1\12\1\22\1\23\1\12\1\24"+ - "\1\25\1\26\1\12\1\27\2\12\1\30\3\12\1\31"+ - "\1\32\1\33\1\34\1\7\1\35\3\12\1\36\1\66"+ - "\1\40\1\41\1\42\1\43\1\44\1\45\1\46\1\47"+ - "\1\50\1\51\1\7\1\52\1\53\1\54\1\55\77\0"+ - "\7\12\2\0\1\12\1\0\6\12\1\0\16\12\5\0"+ - "\3\12\16\0\2\12\4\0\7\12\1\0\1\67\1\12"+ - "\1\0\6\12\1\0\16\12\2\0\1\70\2\0\3\12"+ - "\16\0\2\12\6\0\1\71\2\14\1\0\1\14\2\0"+ - "\1\14\1\72\3\0\1\73\1\0\1\74\6\0\1\74"+ - "\46\0\1\75\2\76\1\0\1\76\2\0\1\76\1\72"+ - "\1\77\1\100\1\101\1\73\1\0\1\74\6\0\1\74"+ - "\16\0\1\100\25\0\1\12\1\0\1\12\2\0\1\12"+ - "\5\0\6\12\1\0\16\12\5\0\3\12\16\0\2\12"+ - "\7\0\2\102\1\0\1\102\2\0\1\102\1\103\61\0"+ - "\7\12\2\0\1\12\1\0\6\12\1\0\1\104\5\12"+ - "\1\104\6\12\1\105\5\0\3\12\16\0\2\12\4\0"+ - "\7\12\2\0\1\12\1\0\6\12\1\0\1\12\1\106"+ - "\14\12\5\0\3\12\16\0\2\12\4\0\7\12\2\0"+ - "\1\12\1\0\6\12\1\0\5\12\1\107\10\12\5\0"+ - "\3\12\16\0\2\12\4\0\7\12\2\0\1\12\1\0"+ - "\6\12\1\0\4\12\1\110\11\12\5\0\3\12\16\0"+ - "\2\12\4\0\7\12\2\0\1\12\1\0\6\12\1\0"+ - "\5\12\1\111\10\12\5\0\3\12\16\0\2\12\4\0"+ - "\7\12\2\0\1\12\1\0\2\12\1\112\3\12\1\0"+ - "\7\12\1\113\6\12\5\0\3\12\16\0\2\12\4\0"+ - "\7\12\2\0\1\12\1\0\6\12\1\0\7\12\1\114"+ - "\6\12\5\0\3\12\16\0\2\12\4\0\7\12\2\0"+ - "\1\12\1\0\2\12\1\115\3\12\1\0\16\12\5\0"+ - "\3\12\16\0\2\12\63\0\1\116\4\0\1\116\51\0"+ - "\1\117\75\0\1\120\101\0\1\121\74\0\1\122\77\0"+ - "\1\123\4\0\1\116\66\0\1\116\14\0\7\12\2\0"+ - "\1\12\1\0\4\12\1\124\1\12\1\0\16\12\5\0"+ - "\3\12\16\0\2\12\4\0\7\12\2\0\1\12\1\0"+ - "\6\12\1\0\1\12\1\125\14\12\5\0\3\12\16\0"+ - "\2\12\74\0\1\126\13\0\1\127\2\0\1\56\6\0"+ - "\1\56\1\130\1\0\2\56\1\0\2\56\11\0\3\56"+ - "\1\0\1\131\1\132\1\0\2\56\72\0\1\133\25\0"+ - "\1\134\1\0\1\134\1\0\1\127\1\134\1\0\1\56"+ - "\6\0\1\56\1\130\1\0\2\56\1\0\2\56\11\0"+ - "\3\56\1\135\1\131\1\132\1\0\2\56\73\0\1\136"+ - "\22\0\1\137\74\0\2\14\1\0\1\14\2\0\1\14"+ - "\65\0\2\102\1\0\1\102\2\0\1\102\6\0\1\74"+ - "\6\0\1\74\63\0\1\140\57\0\2\141\1\0\1\141"+ - "\2\0\1\141\7\0\1\142\55\0\2\76\1\0\1\76"+ - "\2\0\1\76\64\0\1\75\2\76\1\0\1\76\2\0"+ - "\1\76\1\72\3\0\1\73\1\0\1\74\6\0\1\74"+ - "\52\0\1\143\2\0\1\143\65\0\4\144\2\0\1\144"+ - "\1\0\1\144\4\0\1\144\6\0\3\144\2\0\1\144"+ - "\31\0\1\144\11\0\1\145\1\0\1\145\2\0\1\145"+ - "\64\0\1\146\2\102\1\0\1\102\2\0\1\102\4\0"+ - "\1\73\1\0\1\74\6\0\1\74\56\0\1\147\61\0"+ - "\7\12\2\0\1\12\1\0\6\12\1\0\11\12\1\150"+ - "\4\12\5\0\3\12\16\0\2\12\4\0\7\12\2\0"+ - "\1\12\1\0\6\12\1\0\2\12\1\151\13\12\5\0"+ - "\3\12\16\0\2\12\4\0\7\12\2\0\1\12\1\0"+ - "\6\12\1\0\3\12\1\104\12\12\5\0\3\12\16\0"+ - "\2\12\4\0\7\12\2\0\1\12\1\0\6\12\1\0"+ - "\1\12\1\152\14\12\5\0\3\12\16\0\2\12\4\0"+ - "\7\12\2\0\1\12\1\0\6\12\1\0\15\12\1\153"+ - "\5\0\3\12\16\0\2\12\4\0\7\12\2\0\1\12"+ - "\1\0\6\12\1\0\4\12\1\104\11\12\5\0\3\12"+ - "\16\0\2\12\4\0\7\12\2\0\1\12\1\0\6\12"+ - "\1\0\2\12\1\154\13\12\5\0\3\12\16\0\2\12"+ - "\4\0\7\12\2\0\1\12\1\0\6\12\1\0\12\12"+ - "\1\155\3\12\5\0\3\12\16\0\2\12\4\0\7\12"+ - "\2\0\1\12\1\0\6\12\1\0\16\12\5\0\3\12"+ - "\16\0\1\153\1\12\1\0\2\120\1\0\71\120\55\0"+ - "\1\156\74\0\1\157\20\0\7\12\2\0\1\12\1\0"+ - "\6\12\1\0\16\12\5\0\1\153\2\12\16\0\2\12"+ - "\4\0\7\12\2\0\1\12\1\0\2\12\1\153\3\12"+ - "\1\0\16\12\5\0\3\12\16\0\2\12\14\0\1\127"+ - "\2\0\1\56\6\0\1\56\2\0\2\56\1\0\2\56"+ - "\11\0\3\56\4\0\2\56\23\0\4\160\2\0\1\160"+ - "\1\0\1\160\4\0\1\160\6\0\3\160\2\0\1\160"+ - "\31\0\1\160\10\0\4\161\2\0\1\161\1\0\1\161"+ - "\4\0\1\161\6\0\3\161\2\0\1\161\31\0\1\161"+ - "\57\0\1\162\25\0\1\163\1\0\1\163\2\0\1\163"+ - "\65\0\4\164\2\0\1\164\1\0\1\164\4\0\1\164"+ - "\6\0\3\164\2\0\1\164\31\0\1\164\60\0\1\165"+ - "\22\0\1\142\2\141\1\0\1\141\2\0\1\141\65\0"+ - "\2\141\1\0\1\141\2\0\1\141\64\0\1\77\3\0"+ - "\1\143\2\0\1\143\64\0\1\100\4\144\2\0\1\144"+ - "\1\0\1\144\4\0\1\144\6\0\3\144\2\0\1\144"+ - "\31\0\1\144\7\0\1\101\1\0\1\145\1\0\1\145"+ - "\2\0\1\145\65\0\2\102\1\0\1\102\2\0\1\102"+ - "\62\0\7\12\2\0\1\12\1\0\2\12\1\166\3\12"+ - "\1\0\16\12\5\0\3\12\16\0\2\12\4\0\7\12"+ - "\2\0\1\12\1\0\6\12\1\0\2\12\1\167\13\12"+ - "\5\0\3\12\16\0\2\12\4\0\7\12\2\0\1\12"+ - "\1\0\6\12\1\0\5\12\1\170\10\12\5\0\3\12"+ - "\16\0\2\12\4\0\7\12\2\0\1\12\1\0\6\12"+ - "\1\0\10\12\1\152\5\12\5\0\3\12\16\0\2\12"+ - "\4\0\7\12\2\0\1\12\1\0\6\12\1\0\13\12"+ - "\1\171\2\12\5\0\3\12\16\0\2\12\3\0\1\172"+ - "\73\0\1\173\77\0\4\174\2\0\1\174\1\0\1\174"+ - "\4\0\1\174\6\0\3\174\2\0\1\174\31\0\1\174"+ - "\10\0\4\175\2\0\1\175\1\0\1\175\4\0\1\175"+ - "\6\0\3\175\2\0\1\175\31\0\1\175\11\0\1\176"+ - "\1\0\1\176\2\0\1\176\65\0\4\176\2\0\1\176"+ - "\1\0\1\176\4\0\1\176\6\0\3\176\2\0\1\176"+ - "\31\0\1\176\5\0\7\12\2\0\1\12\1\0\6\12"+ - "\1\0\4\12\1\107\11\12\5\0\3\12\16\0\2\12"+ - "\4\0\7\12\2\0\1\12\1\0\6\12\1\0\7\12"+ - "\1\177\6\12\5\0\3\12\16\0\2\12\7\0\4\200"+ - "\2\0\1\200\1\0\1\200\4\0\1\200\6\0\3\200"+ - "\2\0\1\200\31\0\1\200\10\0\4\201\2\0\1\201"+ - "\1\0\1\201\4\0\1\201\6\0\3\201\2\0\1\201"+ - "\31\0\1\201\5\0\7\12\2\0\1\12\1\0\6\12"+ - "\1\0\14\12\1\202\1\12\5\0\3\12\16\0\2\12"+ - "\7\0\4\56\2\0\1\56\1\0\1\56\4\0\1\56"+ - "\6\0\3\56\2\0\1\56\31\0\1\56\10\0\4\130"+ - "\2\0\1\130\1\0\1\130\4\0\1\130\6\0\3\130"+ - "\2\0\1\130\31\0\1\130\5\0\7\12\2\0\1\12"+ - "\1\0\6\12\1\0\5\12\1\104\10\12\5\0\3\12"+ - "\16\0\2\12\1\0"; + "\1\22\1\7\1\23\1\12\1\24\3\12\1\25\1\26"+ + "\1\27\1\30\1\31\5\12\1\32\1\33\1\34\1\35"+ + "\1\36\1\12\1\37\1\40\1\41\1\42\1\43\1\44"+ + "\1\45\1\46\1\47\1\50\1\51\1\7\1\52\1\53"+ + "\1\54\1\55\2\56\1\11\22\56\1\57\10\56\1\60"+ + "\37\56\1\61\22\56\1\57\10\56\1\62\37\56\1\11"+ + "\22\56\1\63\11\56\1\64\36\56\1\61\22\56\1\57"+ + "\11\56\1\65\34\56\1\7\1\10\1\11\1\12\1\7"+ + "\1\13\2\14\1\12\1\15\1\16\1\17\1\14\1\20"+ + "\4\12\1\21\1\12\1\22\1\7\1\23\1\12\1\24"+ + "\3\12\1\25\1\66\1\27\1\30\1\31\5\12\1\32"+ + "\1\33\1\34\1\35\1\36\1\12\1\37\1\40\1\41"+ + "\1\42\1\43\1\44\1\45\1\46\1\47\1\50\1\51"+ + "\1\7\1\52\1\53\1\54\1\55\77\0\7\12\2\0"+ + "\1\12\1\0\6\12\3\0\5\12\4\0\14\12\15\0"+ + "\2\12\4\0\7\12\1\0\1\67\1\12\1\0\6\12"+ + "\3\0\5\12\4\0\14\12\1\70\14\0\2\12\6\0"+ + "\1\71\2\14\1\0\1\14\2\0\1\14\1\72\3\0"+ + "\1\73\1\0\1\74\21\0\1\74\33\0\1\75\2\76"+ + "\1\0\1\76\2\0\1\76\1\72\1\77\1\100\1\101"+ + "\1\73\1\0\1\74\5\0\1\100\13\0\1\74\31\0"+ + "\1\12\1\0\1\12\2\0\1\12\5\0\6\12\3\0"+ + "\5\12\4\0\14\12\15\0\2\12\7\0\2\102\1\0"+ + "\1\102\2\0\1\102\1\103\61\0\7\12\2\0\1\12"+ + "\1\0\6\12\3\0\1\12\1\104\3\12\4\0\6\12"+ + "\1\105\2\12\1\104\2\12\15\0\2\12\27\0\1\106"+ + "\50\0\7\12\2\0\1\12\1\0\2\12\1\107\3\12"+ + "\3\0\5\12\4\0\1\12\1\110\12\12\15\0\2\12"+ + "\37\0\1\111\74\0\1\112\37\0\7\12\2\0\1\12"+ + "\1\0\6\12\3\0\5\12\4\0\1\12\1\113\12\12"+ + "\15\0\2\12\4\0\7\12\2\0\1\12\1\0\2\12"+ + "\1\114\3\12\3\0\5\12\4\0\14\12\15\0\2\12"+ + "\4\0\7\12\2\0\1\12\1\0\6\12\3\0\5\12"+ + "\4\0\5\12\1\115\6\12\15\0\2\12\4\0\7\12"+ + "\2\0\1\12\1\0\6\12\3\0\5\12\4\0\7\12"+ + "\1\116\4\12\15\0\2\12\4\0\7\12\2\0\1\12"+ + "\1\0\6\12\3\0\3\12\1\117\1\12\4\0\14\12"+ + "\15\0\2\12\4\0\7\12\2\0\1\12\1\0\6\12"+ + "\3\0\5\12\4\0\5\12\1\120\6\12\15\0\2\12"+ + "\55\0\1\121\77\0\1\122\6\0\1\123\64\0\1\123"+ + "\6\0\1\123\64\0\1\123\16\0\7\12\2\0\1\12"+ + "\1\0\4\12\1\124\1\12\3\0\5\12\4\0\14\12"+ + "\15\0\2\12\4\0\7\12\2\0\1\12\1\0\6\12"+ + "\3\0\3\12\1\125\1\12\4\0\14\12\15\0\2\12"+ + "\74\0\1\126\13\0\1\127\2\0\1\56\6\0\4\56"+ + "\1\0\1\130\1\131\1\132\1\0\2\56\1\0\1\56"+ + "\5\0\3\56\60\0\1\133\44\0\1\134\1\0\1\134"+ + "\1\0\1\127\1\134\1\0\1\56\6\0\4\56\1\135"+ + "\1\130\1\131\1\132\1\0\2\56\1\0\1\56\5\0"+ + "\3\56\61\0\1\136\41\0\1\137\74\0\2\14\1\0"+ + "\1\14\2\0\1\14\65\0\2\102\1\0\1\102\2\0"+ + "\1\102\6\0\1\74\21\0\1\74\50\0\1\140\57\0"+ + "\2\141\1\0\1\141\2\0\1\141\7\0\1\142\55\0"+ + "\2\76\1\0\1\76\2\0\1\76\64\0\1\75\2\76"+ + "\1\0\1\76\2\0\1\76\1\72\3\0\1\73\1\0"+ + "\1\74\21\0\1\74\37\0\1\143\2\0\1\143\65\0"+ + "\4\144\2\0\1\144\1\0\1\144\4\0\1\144\4\0"+ + "\1\144\10\0\2\144\2\0\1\144\23\0\1\144\11\0"+ + "\1\145\1\0\1\145\2\0\1\145\64\0\1\146\2\102"+ + "\1\0\1\102\2\0\1\102\4\0\1\73\1\0\1\74"+ + "\21\0\1\74\43\0\1\147\61\0\7\12\2\0\1\12"+ + "\1\0\6\12\3\0\5\12\4\0\1\150\13\12\15\0"+ + "\2\12\1\0\2\106\1\0\71\106\3\0\7\12\2\0"+ + "\1\12\1\0\6\12\3\0\5\12\4\0\7\12\1\104"+ + "\4\12\15\0\2\12\4\0\7\12\2\0\1\12\1\0"+ + "\6\12\3\0\5\12\4\0\12\12\1\151\1\12\15\0"+ + "\2\12\37\0\1\152\74\0\1\153\37\0\7\12\2\0"+ + "\1\12\1\0\6\12\3\0\5\12\4\0\2\12\1\154"+ + "\11\12\15\0\2\12\4\0\7\12\2\0\1\12\1\0"+ + "\6\12\3\0\5\12\4\0\14\12\15\0\1\155\1\12"+ + "\4\0\7\12\2\0\1\12\1\0\6\12\3\0\5\12"+ + "\4\0\6\12\1\155\5\12\15\0\2\12\4\0\7\12"+ + "\2\0\1\12\1\0\6\12\3\0\3\12\1\156\1\12"+ + "\4\0\14\12\15\0\2\12\4\0\7\12\2\0\1\12"+ + "\1\0\6\12\3\0\5\12\4\0\12\12\1\157\1\12"+ + "\15\0\2\12\4\0\7\12\2\0\1\12\1\0\6\12"+ + "\3\0\5\12\4\0\10\12\1\104\3\12\15\0\2\12"+ + "\4\0\7\12\2\0\1\12\1\0\6\12\3\0\1\155"+ + "\4\12\4\0\14\12\15\0\2\12\4\0\7\12\2\0"+ + "\1\12\1\0\2\12\1\155\3\12\3\0\5\12\4\0"+ + "\14\12\15\0\2\12\14\0\1\127\2\0\1\56\6\0"+ + "\4\56\5\0\2\56\1\0\1\56\5\0\3\56\30\0"+ + "\4\160\2\0\1\160\1\0\1\160\4\0\1\160\4\0"+ + "\1\160\10\0\2\160\2\0\1\160\23\0\1\160\10\0"+ + "\4\161\2\0\1\161\1\0\1\161\4\0\1\161\4\0"+ + "\1\161\10\0\2\161\2\0\1\161\23\0\1\161\40\0"+ + "\1\162\44\0\1\163\1\0\1\163\2\0\1\163\65\0"+ + "\4\164\2\0\1\164\1\0\1\164\4\0\1\164\4\0"+ + "\1\164\10\0\2\164\2\0\1\164\23\0\1\164\41\0"+ + "\1\165\41\0\1\142\2\141\1\0\1\141\2\0\1\141"+ + "\65\0\2\141\1\0\1\141\2\0\1\141\64\0\1\77"+ + "\3\0\1\143\2\0\1\143\64\0\1\100\4\144\2\0"+ + "\1\144\1\0\1\144\4\0\1\144\4\0\1\144\10\0"+ + "\2\144\2\0\1\144\23\0\1\144\7\0\1\101\1\0"+ + "\1\145\1\0\1\145\2\0\1\145\65\0\2\102\1\0"+ + "\1\102\2\0\1\102\62\0\7\12\2\0\1\12\1\0"+ + "\2\12\1\166\3\12\3\0\5\12\4\0\14\12\15\0"+ + "\2\12\4\0\7\12\2\0\1\12\1\0\6\12\3\0"+ + "\5\12\4\0\13\12\1\156\15\0\2\12\3\0\1\167"+ + "\73\0\1\170\74\0\7\12\2\0\1\12\1\0\6\12"+ + "\3\0\5\12\4\0\3\12\1\171\10\12\15\0\2\12"+ + "\4\0\7\12\2\0\1\12\1\0\6\12\3\0\5\12"+ + "\4\0\5\12\1\172\6\12\15\0\2\12\4\0\7\12"+ + "\2\0\1\12\1\0\6\12\3\0\5\12\4\0\12\12"+ + "\1\173\1\12\15\0\2\12\7\0\4\174\2\0\1\174"+ + "\1\0\1\174\4\0\1\174\4\0\1\174\10\0\2\174"+ + "\2\0\1\174\23\0\1\174\10\0\4\175\2\0\1\175"+ + "\1\0\1\175\4\0\1\175\4\0\1\175\10\0\2\175"+ + "\2\0\1\175\23\0\1\175\11\0\1\176\1\0\1\176"+ + "\2\0\1\176\65\0\4\176\2\0\1\176\1\0\1\176"+ + "\4\0\1\176\4\0\1\176\10\0\2\176\2\0\1\176"+ + "\23\0\1\176\5\0\7\12\2\0\1\12\1\0\6\12"+ + "\3\0\5\12\4\0\7\12\1\120\4\12\15\0\2\12"+ + "\4\0\7\12\2\0\1\12\1\0\6\12\3\0\5\12"+ + "\4\0\1\12\1\177\12\12\15\0\2\12\7\0\4\200"+ + "\2\0\1\200\1\0\1\200\4\0\1\200\4\0\1\200"+ + "\10\0\2\200\2\0\1\200\23\0\1\200\10\0\4\201"+ + "\2\0\1\201\1\0\1\201\4\0\1\201\4\0\1\201"+ + "\10\0\2\201\2\0\1\201\23\0\1\201\5\0\7\12"+ + "\2\0\1\12\1\0\6\12\3\0\5\12\4\0\4\12"+ + "\1\202\7\12\15\0\2\12\7\0\4\56\2\0\1\56"+ + "\1\0\1\56\4\0\1\56\4\0\1\56\10\0\2\56"+ + "\2\0\1\56\23\0\1\56\10\0\4\130\2\0\1\130"+ + "\1\0\1\130\4\0\1\130\4\0\1\130\10\0\2\130"+ + "\2\0\1\130\23\0\1\130\5\0\7\12\2\0\1\12"+ + "\1\0\6\12\3\0\5\12\4\0\5\12\1\104\6\12"+ + "\15\0\2\12\1\0"; private static int [] zzUnpackTrans() { int [] result = new int[5580]; @@ -420,13 +422,13 @@ private static int zzUnpackTrans(String packed, int offset, int [] result) { private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); private static final String ZZ_ATTRIBUTE_PACKED_0 = - "\6\0\3\11\4\1\1\11\3\1\1\11\7\1\1\11"+ - "\3\1\2\11\2\1\3\11\1\1\3\11\1\1\1\11"+ - "\3\1\1\11\1\1\2\11\2\1\1\11\1\1\1\11"+ - "\3\0\2\1\6\0\1\1\1\0\12\1\2\11\1\1"+ - "\2\0\1\11\2\1\1\11\3\0\1\11\4\0\2\11"+ - "\1\1\1\0\3\1\1\0\1\11\6\1\4\0\1\11"+ - "\2\0\1\11\4\1\2\11\2\0\1\11\1\1\2\0"+ + "\6\0\3\11\4\1\1\11\3\1\1\11\2\1\2\11"+ + "\11\1\3\11\1\1\4\11\2\1\1\11\3\1\1\11"+ + "\1\1\2\11\2\1\1\11\1\1\1\11\3\0\2\1"+ + "\6\0\1\1\1\0\5\1\2\0\6\1\3\11\2\1"+ + "\1\11\3\0\1\11\4\0\2\11\1\1\1\0\3\1"+ + "\1\0\1\11\2\1\2\0\4\1\2\0\1\11\2\0"+ + "\1\11\1\1\2\11\3\1\2\0\1\11\1\1\2\0"+ "\1\1"; private static int [] zzUnpackAttribute() { @@ -760,207 +762,207 @@ else if (zzAtEOF) { { return BAD_CHARACTER; } // fall through - case 45: break; + case 47: break; case 2: { return WHITE_SPACE; } // fall through - case 46: break; + case 48: break; case 3: { return WHITE_SPACE_NEWLINE; } // fall through - case 47: break; + case 49: break; case 4: { return IDENTIFIER; } // fall through - case 48: break; + case 50: break; case 5: { return INT_LIT; } // fall through - case 49: break; + case 51: break; case 6: { return COMMA; } // fall through - case 50: break; + case 52: break; case 7: - { return OPERATOR; + { return DOT; } // fall through - case 51: break; + case 53: break; case 8: { return ADD_OP; } // fall through - case 52: break; - case 9: - { return QMARK; - } - // fall through - case 53: break; - case 10: - { return PIPE; - } - // fall through case 54: break; - case 11: + case 9: { return MUL_OP; } // fall through case 55: break; - case 12: + case 10: { return LEFT_PAREN; } // fall through case 56: break; - case 13: + case 11: { return RIGHT_PAREN; } // fall through case 57: break; - case 14: + case 12: { pushState(STRING_LITERAL); return DOUBLE_QUOTE; } // fall through case 58: break; - case 15: + case 13: { pushState(BYTE_LITERAL); return SINGLE_QUOTE; } // fall through case 59: break; - case 16: - { return LEFT_CURLY; + case 14: + { return OP_DISJUNCTION; } // fall through case 60: break; - case 17: - { return RIGHT_CURLY; + case 15: + { return LEFT_CURLY; } // fall through case 61: break; - case 18: - { return COLON; + case 16: + { return RIGHT_CURLY; } // fall through case 62: break; - case 19: - { return EQ; + case 17: + { return COLON; } // fall through case 63: break; - case 20: - { return LEFT_BRACKET; + case 18: + { return EQ; } // fall through case 64: break; - case 21: - { return RIGHT_BRACKET; + case 19: + { return QMARK; } // fall through case 65: break; - case 22: + case 20: { return AT; } // fall through case 66: break; - case 23: - { return REL_OP; + case 21: + { return LEFT_BRACKET; } // fall through case 67: break; - case 24: - { return AMP; + case 22: + { return RIGHT_BRACKET; } // fall through case 68: break; - case 25: - { return UNICODE_VALUE; + case 23: + { return EXCL; } // fall through case 69: break; - case 26: - { popState(); return DOUBLE_QUOTE_END; + case 24: + { return REL_OP; } // fall through case 70: break; - case 27: - { return NEWLINE; + case 25: + { return OP_UNIFICATION; } // fall through case 71: break; - case 28: - { popState(); return SINGLE_QUOTE_END; + case 26: + { return UNICODE_VALUE; } // fall through case 72: break; - case 29: - { popState(); return INTERPOLATION_END; + case 27: + { popState(); return DOUBLE_QUOTE_END; } // fall through case 73: break; - case 30: - { return FLOAT_LIT; + case 28: + { return NEWLINE; } // fall through case 74: break; - case 31: - { return KEYWORD; + case 29: + { popState(); return SINGLE_QUOTE_END; } // fall through case 75: break; - case 32: - { return PIPE_PIPE; + case 30: + { popState(); return INTERPOLATION_END; } // fall through case 76: break; + case 31: + { return FLOAT_LIT; + } + // fall through + case 77: break; + case 32: + { return KEYWORD; + } + // fall through + case 78: break; case 33: { return COMMENT; } // fall through - case 77: break; + case 79: break; case 34: - { return EQ_EQ; + { return OP_OR; } // fall through - case 78: break; + case 80: break; case 35: - { return AMP_AMP; + { return OP_EQ; } // fall through - case 79: break; + case 81: break; case 36: - { pushState(EXPRESSION); return INTERPOLATION_START; + { return OP_AND; } // fall through - case 80: break; + case 82: break; case 37: - { return ELLIPSIS_TOKEN; + { pushState(EXPRESSION); return INTERPOLATION_START; } // fall through - case 81: break; + case 83: break; case 38: - { popState(); return MULTILINE_STRING_END; + { return BOTTOM; } // fall through - case 82: break; + case 84: break; case 39: - { popState(); return MULTILINE_BYTES_END; + { return ELLIPSIS_TOKEN; } // fall through - case 83: break; + case 85: break; case 40: - { return NULL_LIT; + { popState(); return MULTILINE_STRING_END; } // fall through - case 84: break; + case 86: break; case 41: - { return BOOL_LIT; + { popState(); return MULTILINE_BYTES_END; } // fall through - case 85: break; + case 87: break; case 42: // lookahead expression with fixed base length zzMarkedPos = Character.offsetByCodePoints @@ -968,7 +970,7 @@ else if (zzAtEOF) { { pushState(STRING_MULTILINE); return MULTILINE_STRING_START; } // fall through - case 86: break; + case 88: break; case 43: // lookahead expression with fixed base length zzMarkedPos = Character.offsetByCodePoints @@ -976,12 +978,22 @@ else if (zzAtEOF) { { pushState(BYTES_MULTILINE); return MULTILINE_BYTES_START; } // fall through - case 87: break; + case 89: break; case 44: + { return BOOL_LIT; + } + // fall through + case 90: break; + case 45: + { return NULL_LIT; + } + // fall through + case 91: break; + case 46: { return BYTE_VALUE; } // fall through - case 88: break; + case 92: break; default: zzScanError(ZZ_NO_MATCH); } diff --git a/src/main/java-gen/dev/monogon/cue/lang/parser/CueParser.java b/src/main/java-gen/dev/monogon/cue/lang/parser/CueParser.java index 6c3c62e..7856403 100644 --- a/src/main/java-gen/dev/monogon/cue/lang/parser/CueParser.java +++ b/src/main/java-gen/dev/monogon/cue/lang/parser/CueParser.java @@ -36,7 +36,7 @@ static boolean parse_root_(IElementType t, PsiBuilder b, int l) { } public static final TokenSet[] EXTENDS_SETS_ = new TokenSet[] { - create_token_set_(DECLARATION, ELLIPSIS, EMBEDDING, FIELD), + create_token_set_(DECLARATION, EMBEDDING, FIELD), create_token_set_(ALIAS_EXPR, ARGUMENT, ARGUMENTS, BASIC_LIT, BINARY_EXPR, EXPRESSION, INDEX, LIST_LIT, LITERAL, MULTILINE_BYTES_LIT, MULTILINE_STRING_LIT, OPERAND, @@ -83,13 +83,14 @@ public static boolean Argument(PsiBuilder b, int l) { public static boolean Arguments(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "Arguments")) return false; if (!nextTokenIsFast(b, LEFT_PAREN)) return false; - boolean r; - Marker m = enter_section_(b); + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, ARGUMENTS, null); r = consumeTokenFast(b, LEFT_PAREN); - r = r && Arguments_1(b, l + 1); - r = r && consumeToken(b, RIGHT_PAREN); - exit_section_(b, m, ARGUMENTS, r); - return r; + p = r; // pin = 1 + r = r && report_error_(b, Arguments_1(b, l + 1)); + r = p && consumeToken(b, RIGHT_PAREN) && r; + exit_section_(b, l, m, r, p, null); + return r || p; } // [ ( Argument { "," Argument }* ) [ "," ] ] @@ -551,13 +552,14 @@ private static boolean ImportSpec_0(PsiBuilder b, int l) { public static boolean Index(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "Index")) return false; if (!nextTokenIsFast(b, LEFT_BRACKET)) return false; - boolean r; - Marker m = enter_section_(b); + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, INDEX, null); r = consumeTokenFast(b, LEFT_BRACKET); - r = r && Expression(b, l + 1, -1); - r = r && consumeToken(b, RIGHT_BRACKET); - exit_section_(b, m, INDEX, r); - return r; + p = r; // pin = 1 + r = r && report_error_(b, Expression(b, l + 1, -1)); + r = p && consumeToken(b, RIGHT_BRACKET) && r; + exit_section_(b, l, m, r, p, null); + return r || p; } /* ********************************************************** */ @@ -590,7 +592,7 @@ private static boolean Label_0_0(PsiBuilder b, int l) { } /* ********************************************************** */ - // LabelName [ "?" ] | "[" AliasExpr "]" + // LabelName ["?"] | "[" AliasExpr "]" public static boolean LabelExpr(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "LabelExpr")) return false; boolean r; @@ -601,7 +603,7 @@ public static boolean LabelExpr(PsiBuilder b, int l) { return r; } - // LabelName [ "?" ] + // LabelName ["?"] private static boolean LabelExpr_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "LabelExpr_0")) return false; boolean r; @@ -612,7 +614,7 @@ private static boolean LabelExpr_0(PsiBuilder b, int l) { return r; } - // [ "?" ] + // ["?"] private static boolean LabelExpr_0_1(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "LabelExpr_0_1")) return false; consumeTokenFast(b, QMARK); @@ -632,13 +634,14 @@ private static boolean LabelExpr_1(PsiBuilder b, int l) { } /* ********************************************************** */ - // IDENTIFIER | simple_string_lit + // <> | simple_string_lit static boolean LabelName(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "LabelName")) return false; - if (!nextTokenIsFast(b, DOUBLE_QUOTE, IDENTIFIER)) return false; boolean r; - r = consumeTokenFast(b, IDENTIFIER); + Marker m = enter_section_(b); + r = struct_label(b, l + 1); if (!r) r = simple_string_lit(b, l + 1); + exit_section_(b, m, null, r); return r; } @@ -656,66 +659,70 @@ public static boolean LetClause(PsiBuilder b, int l) { } /* ********************************************************** */ - // "[" [ ElementList [ "," [ Ellipsis ] ] [ "," ] ] "]" + // "[" [ListLitInner | Ellipsis] "]" public static boolean ListLit(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "ListLit")) return false; if (!nextTokenIsFast(b, LEFT_BRACKET)) return false; - boolean r; - Marker m = enter_section_(b); + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, LIST_LIT, null); r = consumeTokenFast(b, LEFT_BRACKET); - r = r && ListLit_1(b, l + 1); - r = r && consumeToken(b, RIGHT_BRACKET); - exit_section_(b, m, LIST_LIT, r); - return r; + p = r; // pin = 1 + r = r && report_error_(b, ListLit_1(b, l + 1)); + r = p && consumeToken(b, RIGHT_BRACKET) && r; + exit_section_(b, l, m, r, p, null); + return r || p; } - // [ ElementList [ "," [ Ellipsis ] ] [ "," ] ] + // [ListLitInner | Ellipsis] private static boolean ListLit_1(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "ListLit_1")) return false; ListLit_1_0(b, l + 1); return true; } - // ElementList [ "," [ Ellipsis ] ] [ "," ] + // ListLitInner | Ellipsis private static boolean ListLit_1_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "ListLit_1_0")) return false; boolean r; + r = ListLitInner(b, l + 1); + if (!r) r = Ellipsis(b, l + 1); + return r; + } + + /* ********************************************************** */ + // ElementList ["," Ellipsis] [","] + static boolean ListLitInner(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "ListLitInner")) return false; + boolean r; Marker m = enter_section_(b); r = ElementList(b, l + 1); - r = r && ListLit_1_0_1(b, l + 1); - r = r && ListLit_1_0_2(b, l + 1); + r = r && ListLitInner_1(b, l + 1); + r = r && ListLitInner_2(b, l + 1); exit_section_(b, m, null, r); return r; } - // [ "," [ Ellipsis ] ] - private static boolean ListLit_1_0_1(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "ListLit_1_0_1")) return false; - ListLit_1_0_1_0(b, l + 1); + // ["," Ellipsis] + private static boolean ListLitInner_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "ListLitInner_1")) return false; + ListLitInner_1_0(b, l + 1); return true; } - // "," [ Ellipsis ] - private static boolean ListLit_1_0_1_0(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "ListLit_1_0_1_0")) return false; + // "," Ellipsis + private static boolean ListLitInner_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "ListLitInner_1_0")) return false; boolean r; Marker m = enter_section_(b); r = consumeTokenFast(b, COMMA); - r = r && ListLit_1_0_1_0_1(b, l + 1); + r = r && Ellipsis(b, l + 1); exit_section_(b, m, null, r); return r; } - // [ Ellipsis ] - private static boolean ListLit_1_0_1_0_1(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "ListLit_1_0_1_0_1")) return false; - Ellipsis(b, l + 1); - return true; - } - - // [ "," ] - private static boolean ListLit_1_0_2(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "ListLit_1_0_2")) return false; + // [","] + private static boolean ListLitInner_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "ListLitInner_2")) return false; consumeTokenFast(b, COMMA); return true; } @@ -831,8 +838,7 @@ public static boolean QualifiedIdent(PsiBuilder b, int l) { boolean r; Marker m = enter_section_(b); r = PackageName(b, l + 1); - r = r && consumeToken(b, "."); - r = r && consumeToken(b, IDENTIFIER); + r = r && consumeTokens(b, 0, DOT, IDENTIFIER); exit_section_(b, m, QUALIFIED_IDENT, r); return r; } @@ -841,11 +847,12 @@ public static boolean QualifiedIdent(PsiBuilder b, int l) { // "." (IDENTIFIER | simple_string_lit) public static boolean Selector(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "Selector")) return false; + if (!nextTokenIsFast(b, DOT)) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, SELECTOR, ""); - r = consumeTokenFast(b, "."); + Marker m = enter_section_(b); + r = consumeTokenFast(b, DOT); r = r && Selector_1(b, l + 1); - exit_section_(b, l, m, r, false, null); + exit_section_(b, m, SELECTOR, r); return r; } @@ -871,41 +878,68 @@ public static boolean StartClause(PsiBuilder b, int l) { } /* ********************************************************** */ - // "{" { Declaration "," }* "}" + // "{" [ Declaration {"," Declaration}* ","? ] "}" public static boolean StructLit(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "StructLit")) return false; if (!nextTokenIsFast(b, LEFT_CURLY)) return false; - boolean r; - Marker m = enter_section_(b); + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, STRUCT_LIT, null); r = consumeTokenFast(b, LEFT_CURLY); - r = r && StructLit_1(b, l + 1); - r = r && consumeToken(b, RIGHT_CURLY); - exit_section_(b, m, STRUCT_LIT, r); - return r; + p = r; // pin = 1 + r = r && report_error_(b, StructLit_1(b, l + 1)); + r = p && consumeToken(b, RIGHT_CURLY) && r; + exit_section_(b, l, m, r, p, null); + return r || p; } - // { Declaration "," }* + // [ Declaration {"," Declaration}* ","? ] private static boolean StructLit_1(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "StructLit_1")) return false; - while (true) { - int c = current_position_(b); - if (!StructLit_1_0(b, l + 1)) break; - if (!empty_element_parsed_guard_(b, "StructLit_1", c)) break; - } + StructLit_1_0(b, l + 1); return true; } - // Declaration "," + // Declaration {"," Declaration}* ","? private static boolean StructLit_1_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "StructLit_1_0")) return false; boolean r; Marker m = enter_section_(b); r = Declaration(b, l + 1); - r = r && consumeToken(b, COMMA); + r = r && StructLit_1_0_1(b, l + 1); + r = r && StructLit_1_0_2(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // {"," Declaration}* + private static boolean StructLit_1_0_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "StructLit_1_0_1")) return false; + while (true) { + int c = current_position_(b); + if (!StructLit_1_0_1_0(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "StructLit_1_0_1", c)) break; + } + return true; + } + + // "," Declaration + private static boolean StructLit_1_0_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "StructLit_1_0_1_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeTokenFast(b, COMMA); + r = r && Declaration(b, l + 1); exit_section_(b, m, null, r); return r; } + // ","? + private static boolean StructLit_1_0_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "StructLit_1_0_2")) return false; + consumeTokenFast(b, COMMA); + return true; + } + /* ********************************************************** */ // ADD_OP static boolean add_op(PsiBuilder b, int l) { @@ -987,25 +1021,26 @@ private static boolean attr_tokens_0_3(PsiBuilder b, int l) { public static boolean attribute(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "attribute")) return false; if (!nextTokenIsFast(b, AT)) return false; - boolean r; - Marker m = enter_section_(b); - r = consumeTokens(b, 0, AT, IDENTIFIER, LEFT_PAREN); - r = r && attr_tokens(b, l + 1); - r = r && consumeToken(b, RIGHT_PAREN); - exit_section_(b, m, ATTRIBUTE, r); - return r; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, ATTRIBUTE, null); + r = consumeTokens(b, 1, AT, IDENTIFIER, LEFT_PAREN); + p = r; // pin = 1 + r = r && report_error_(b, attr_tokens(b, l + 1)); + r = p && consumeToken(b, RIGHT_PAREN) && r; + exit_section_(b, l, m, r, p, null); + return r || p; } /* ********************************************************** */ - // PIPE | AMP | PIPE_PIPE | AMP_AMP | EQ_EQ | rel_op | add_op | mul_op + // OP_DISJUNCTION | OP_UNIFICATION | OP_OR | OP_AND | OP_EQ | rel_op | add_op | mul_op static boolean binary_op(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "binary_op")) return false; boolean r; - r = consumeTokenFast(b, PIPE); - if (!r) r = consumeTokenFast(b, AMP); - if (!r) r = consumeTokenFast(b, PIPE_PIPE); - if (!r) r = consumeTokenFast(b, AMP_AMP); - if (!r) r = consumeTokenFast(b, EQ_EQ); + r = consumeTokenFast(b, OP_DISJUNCTION); + if (!r) r = consumeTokenFast(b, OP_UNIFICATION); + if (!r) r = consumeTokenFast(b, OP_OR); + if (!r) r = consumeTokenFast(b, OP_AND); + if (!r) r = consumeTokenFast(b, OP_EQ); if (!r) r = rel_op(b, l + 1); if (!r) r = add_op(b, l + 1); if (!r) r = mul_op(b, l + 1); @@ -1308,12 +1343,12 @@ private static boolean string_lit_4(PsiBuilder b, int l) { } /* ********************************************************** */ - // ADD_OP | "!" | "*" | rel_op + // ADD_OP | EXCL | "*" | rel_op static boolean unary_op(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "unary_op")) return false; boolean r; r = consumeTokenFast(b, ADD_OP); - if (!r) r = consumeTokenFast(b, "!"); + if (!r) r = consumeTokenFast(b, EXCL); if (!r) r = consumeTokenFast(b, "*"); if (!r) r = rel_op(b, l + 1); return r; diff --git a/src/main/java-gen/dev/monogon/cue/lang/psi/CueAttribute.java b/src/main/java-gen/dev/monogon/cue/lang/psi/CueAttribute.java index 0c71908..08d7ce9 100644 --- a/src/main/java-gen/dev/monogon/cue/lang/psi/CueAttribute.java +++ b/src/main/java-gen/dev/monogon/cue/lang/psi/CueAttribute.java @@ -7,7 +7,7 @@ public interface CueAttribute extends CueCompositeElement { - @NotNull + @Nullable CueAttrTokens getAttrTokens(); } diff --git a/src/main/java-gen/dev/monogon/cue/lang/psi/CueDeclaration.java b/src/main/java-gen/dev/monogon/cue/lang/psi/CueDeclaration.java index 5070c28..7e5f26b 100644 --- a/src/main/java-gen/dev/monogon/cue/lang/psi/CueDeclaration.java +++ b/src/main/java-gen/dev/monogon/cue/lang/psi/CueDeclaration.java @@ -7,6 +7,9 @@ public interface CueDeclaration extends CueCompositeElement { + @Nullable + CueEllipsis getEllipsis(); + @Nullable CueLetClause getLetClause(); diff --git a/src/main/java-gen/dev/monogon/cue/lang/psi/CueEllipsis.java b/src/main/java-gen/dev/monogon/cue/lang/psi/CueEllipsis.java index 10eb9d9..f4c64fd 100644 --- a/src/main/java-gen/dev/monogon/cue/lang/psi/CueEllipsis.java +++ b/src/main/java-gen/dev/monogon/cue/lang/psi/CueEllipsis.java @@ -5,7 +5,7 @@ import org.jetbrains.annotations.*; import com.intellij.psi.PsiElement; -public interface CueEllipsis extends CueDeclaration { +public interface CueEllipsis extends CueCompositeElement { @Nullable CueExpression getExpression(); diff --git a/src/main/java-gen/dev/monogon/cue/lang/psi/CueIndex.java b/src/main/java-gen/dev/monogon/cue/lang/psi/CueIndex.java index 120d94e..8919bff 100644 --- a/src/main/java-gen/dev/monogon/cue/lang/psi/CueIndex.java +++ b/src/main/java-gen/dev/monogon/cue/lang/psi/CueIndex.java @@ -7,7 +7,7 @@ public interface CueIndex extends CuePrimaryExpr { - @NotNull + @Nullable CueExpression getExpression(); } diff --git a/src/main/java-gen/dev/monogon/cue/lang/psi/CueVisitor.java b/src/main/java-gen/dev/monogon/cue/lang/psi/CueVisitor.java index d89b043..fed5f29 100644 --- a/src/main/java-gen/dev/monogon/cue/lang/psi/CueVisitor.java +++ b/src/main/java-gen/dev/monogon/cue/lang/psi/CueVisitor.java @@ -47,7 +47,7 @@ public void visitElementList(@NotNull CueElementList o) { } public void visitEllipsis(@NotNull CueEllipsis o) { - visitDeclaration(o); + visitCompositeElement(o); } public void visitEmbedding(@NotNull CueEmbedding o) { diff --git a/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueAttributeImpl.java b/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueAttributeImpl.java index b5efcee..34212d7 100644 --- a/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueAttributeImpl.java +++ b/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueAttributeImpl.java @@ -28,9 +28,9 @@ public void accept(@NotNull PsiElementVisitor visitor) { } @Override - @NotNull + @Nullable public CueAttrTokens getAttrTokens() { - return findNotNullChildByClass(CueAttrTokens.class); + return findChildByClass(CueAttrTokens.class); } } diff --git a/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueDeclarationImpl.java b/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueDeclarationImpl.java index b6a16c1..76d9194 100644 --- a/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueDeclarationImpl.java +++ b/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueDeclarationImpl.java @@ -27,6 +27,12 @@ public void accept(@NotNull PsiElementVisitor visitor) { else super.accept(visitor); } + @Override + @Nullable + public CueEllipsis getEllipsis() { + return findChildByClass(CueEllipsis.class); + } + @Override @Nullable public CueLetClause getLetClause() { diff --git a/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueEllipsisImpl.java b/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueEllipsisImpl.java index 4d1be0d..2948b3f 100644 --- a/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueEllipsisImpl.java +++ b/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueEllipsisImpl.java @@ -8,15 +8,15 @@ import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.util.PsiTreeUtil; import static dev.monogon.cue.lang.CueTypes.*; +import dev.monogon.cue.lang.psi.CueCompositeElementImpl; import dev.monogon.cue.lang.psi.*; -public class CueEllipsisImpl extends CueDeclarationImpl implements CueEllipsis { +public class CueEllipsisImpl extends CueCompositeElementImpl implements CueEllipsis { public CueEllipsisImpl(@NotNull ASTNode node) { super(node); } - @Override public void accept(@NotNull CueVisitor visitor) { visitor.visitEllipsis(this); } diff --git a/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueIndexImpl.java b/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueIndexImpl.java index e9621e4..4bea566 100644 --- a/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueIndexImpl.java +++ b/src/main/java-gen/dev/monogon/cue/lang/psi/impl/CueIndexImpl.java @@ -28,9 +28,9 @@ public void accept(@NotNull PsiElementVisitor visitor) { } @Override - @NotNull + @Nullable public CueExpression getExpression() { - return findNotNullChildByClass(CueExpression.class); + return findChildByClass(CueExpression.class); } } diff --git a/src/main/java/dev/monogon/cue/Icons.java b/src/main/java/dev/monogon/cue/Icons.java index 6287ac6..ea95b4f 100644 --- a/src/main/java/dev/monogon/cue/Icons.java +++ b/src/main/java/dev/monogon/cue/Icons.java @@ -1,4 +1,9 @@ package dev.monogon.cue; +import com.intellij.openapi.util.IconLoader; + +import javax.swing.*; + public class Icons { + public static final Icon CueLogo = IconLoader.getIcon("/icons/cue_logo.svg", Icons.class); } diff --git a/src/main/java/dev/monogon/cue/lang/CueFileType.java b/src/main/java/dev/monogon/cue/lang/CueFileType.java index 1084e59..dc6edc4 100644 --- a/src/main/java/dev/monogon/cue/lang/CueFileType.java +++ b/src/main/java/dev/monogon/cue/lang/CueFileType.java @@ -3,6 +3,7 @@ import com.intellij.openapi.fileTypes.LanguageFileType; import com.intellij.openapi.util.NlsContexts; import com.intellij.openapi.util.NlsSafe; +import dev.monogon.cue.Icons; import dev.monogon.cue.Messages; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -35,6 +36,6 @@ protected CueFileType() { @Override public @Nullable Icon getIcon() { - return null; + return Icons.CueLogo; } } diff --git a/src/main/java/dev/monogon/cue/lang/CueTokenTypes.java b/src/main/java/dev/monogon/cue/lang/CueTokenTypes.java index 60946b9..dc12da8 100644 --- a/src/main/java/dev/monogon/cue/lang/CueTokenTypes.java +++ b/src/main/java/dev/monogon/cue/lang/CueTokenTypes.java @@ -15,14 +15,13 @@ public interface CueTokenTypes { TokenSet STRING_LITERALS = TokenSet.EMPTY; TokenSet OPERATORS = TokenSet.create( - CueTypes.OPERATOR, CueTypes.ADD_OP, CueTypes.MUL_OP, CueTypes.REL_OP, - CueTypes.PIPE, - CueTypes.AMP, - CueTypes.PIPE_PIPE, - CueTypes.AMP_AMP, - CueTypes.EQ_EQ + CueTypes.OP_DISJUNCTION, + CueTypes.OP_UNIFICATION, + CueTypes.OP_AND, + CueTypes.OP_OR, + CueTypes.OP_EQ ); } diff --git a/src/main/java/dev/monogon/cue/lang/highlighter/CueHighlightingColors.java b/src/main/java/dev/monogon/cue/lang/highlighter/CueHighlightingColors.java index 5eb4a62..5af6a3c 100644 --- a/src/main/java/dev/monogon/cue/lang/highlighter/CueHighlightingColors.java +++ b/src/main/java/dev/monogon/cue/lang/highlighter/CueHighlightingColors.java @@ -21,9 +21,11 @@ public interface CueHighlightingColors { TextAttributesKey BRACKETS = createTextAttributesKey("cue.brackets", DefaultLanguageHighlighterColors.BRACKETS); TextAttributesKey BRACES = createTextAttributesKey("cue.braces", DefaultLanguageHighlighterColors.BRACES); + TextAttributesKey COMMA = createTextAttributesKey("cue.comma", DefaultLanguageHighlighterColors.COMMA); + TextAttributesKey STRING_CONTENT = createTextAttributesKey("cue.string_content", DefaultLanguageHighlighterColors.STRING); - //TextAttributesKey STRING_LITERAL = createTextAttributesKey("cue.string_literal", DefaultLanguageHighlighterColors.STRING); - //TextAttributesKey STRING_LITERAL_MULTILINE = createTextAttributesKey("cue.string_multiline", STRING_LITERAL); - //TextAttributesKey BYTE_LITERAL = createTextAttributesKey("cue.byte_literal", DefaultLanguageHighlighterColors.STRING); - //TextAttributesKey BYTE_LITERAL_MULTILINE = createTextAttributesKey("cue.byte_multiline", BYTE_LITERAL); + TextAttributesKey STRING_SINGLE_QUOTES = createTextAttributesKey("cue.single_quote", DefaultLanguageHighlighterColors.STRING); + TextAttributesKey STRING_DOUBLE_QUOTES = createTextAttributesKey("cue.double_quote", DefaultLanguageHighlighterColors.STRING); + TextAttributesKey TRIPLE_QUOTES_STRING = createTextAttributesKey("cue.string_multiline", DefaultLanguageHighlighterColors.STRING); + TextAttributesKey TRIPLE_QUOTES_BYTE = createTextAttributesKey("cue.byte_multiline", DefaultLanguageHighlighterColors.STRING); } diff --git a/src/main/java/dev/monogon/cue/lang/highlighter/CueSyntaxHighlighter.java b/src/main/java/dev/monogon/cue/lang/highlighter/CueSyntaxHighlighter.java index 2825d9d..ad84c34 100644 --- a/src/main/java/dev/monogon/cue/lang/highlighter/CueSyntaxHighlighter.java +++ b/src/main/java/dev/monogon/cue/lang/highlighter/CueSyntaxHighlighter.java @@ -26,6 +26,14 @@ public class CueSyntaxHighlighter extends SyntaxHighlighterBase implements Synta map.put(CueTypes.INT_LIT, CueHighlightingColors.INT_LITERAL); map.put(CueTypes.NULL_LIT, CueHighlightingColors.NULL_LITERAL); + map.put(CueTypes.DOUBLE_QUOTE, CueHighlightingColors.STRING_DOUBLE_QUOTES); + map.put(CueTypes.DOUBLE_QUOTE_END, CueHighlightingColors.STRING_DOUBLE_QUOTES); + map.put(CueTypes.SINGLE_QUOTE, CueHighlightingColors.STRING_SINGLE_QUOTES); + map.put(CueTypes.SINGLE_QUOTE_END, CueHighlightingColors.STRING_SINGLE_QUOTES); + map.put(CueTypes.MULTILINE_STRING_START, CueHighlightingColors.TRIPLE_QUOTES_STRING); + map.put(CueTypes.MULTILINE_STRING_END, CueHighlightingColors.TRIPLE_QUOTES_STRING); + map.put(CueTypes.MULTILINE_BYTES_START, CueHighlightingColors.TRIPLE_QUOTES_BYTE); + map.put(CueTypes.MULTILINE_BYTES_END, CueHighlightingColors.TRIPLE_QUOTES_BYTE); map.put(CueTypes.UNICODE_VALUE, CueHighlightingColors.STRING_CONTENT); map.put(CueTypes.LEFT_PAREN, CueHighlightingColors.PARENTHESES); @@ -37,6 +45,8 @@ public class CueSyntaxHighlighter extends SyntaxHighlighterBase implements Synta map.put(CueTypes.LEFT_CURLY, CueHighlightingColors.BRACES); map.put(CueTypes.RIGHT_CURLY, CueHighlightingColors.BRACES); + map.put(CueTypes.COMMA, CueHighlightingColors.COMMA); + // token sets fillMap(map, CueTokenTypes.OPERATORS, CueHighlightingColors.OPERATOR); } diff --git a/src/main/java/dev/monogon/cue/lang/parser/CueParserUtil.java b/src/main/java/dev/monogon/cue/lang/parser/CueParserUtil.java index e2afe29..6bfec84 100644 --- a/src/main/java/dev/monogon/cue/lang/parser/CueParserUtil.java +++ b/src/main/java/dev/monogon/cue/lang/parser/CueParserUtil.java @@ -2,6 +2,7 @@ import com.intellij.lang.PsiBuilder; import com.intellij.lang.parser.GeneratedParserUtilBase; +import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.TokenSet; import dev.monogon.cue.lang.CueTypes; @@ -21,4 +22,22 @@ public static boolean attr_token(PsiBuilder b, int level) { b.advanceLexer(); return true; } + + /** + * All keywords are allowed as labels/field names. + * https://cuelang.org/docs/references/spec/#keywords + */ + public static boolean struct_label(PsiBuilder b, int level) { + IElementType type = b.getTokenType(); + if (type == CueTypes.IDENTIFIER) { + b.advanceLexer(); + return true; + } + if (type == CueTypes.KEYWORD) { + b.remapCurrentToken(CueTypes.IDENTIFIER); + b.advanceLexer(); + return true; + } + return false; + } } \ No newline at end of file diff --git a/src/main/java/dev/monogon/cue/lang/psi/CueFile.java b/src/main/java/dev/monogon/cue/lang/psi/CueFile.java index 7d39f1e..768abe0 100644 --- a/src/main/java/dev/monogon/cue/lang/psi/CueFile.java +++ b/src/main/java/dev/monogon/cue/lang/psi/CueFile.java @@ -3,10 +3,13 @@ import com.intellij.extapi.psi.PsiFileBase; import com.intellij.openapi.fileTypes.FileType; import com.intellij.psi.FileViewProvider; +import dev.monogon.cue.Icons; import dev.monogon.cue.lang.CueFileType; import dev.monogon.cue.lang.CueLanguage; import org.jetbrains.annotations.NotNull; +import javax.swing.*; + public class CueFile extends PsiFileBase { public CueFile(@NotNull FileViewProvider viewProvider) { super(viewProvider, CueLanguage.INSTANCE); diff --git a/src/main/resources/icons/cue_logo.svg b/src/main/resources/icons/cue_logo.svg new file mode 100644 index 0000000..c01f796 --- /dev/null +++ b/src/main/resources/icons/cue_logo.svg @@ -0,0 +1,148 @@ + + + + + Produced by OmniGraffle 7.10.1 + 2019-08-10 23:02:54 +0000 + + + image/svg+xml + + + + + + + Canvas 1 + + Layer 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/data/lang/cue/inserting_lexer/struct_single.cue b/src/test/data/lang/cue/inserting_lexer/struct_single.cue new file mode 100644 index 0000000..72c7dd4 --- /dev/null +++ b/src/test/data/lang/cue/inserting_lexer/struct_single.cue @@ -0,0 +1 @@ +{file: string} diff --git a/src/test/data/lang/cue/inserting_lexer/struct_single.txt b/src/test/data/lang/cue/inserting_lexer/struct_single.txt new file mode 100644 index 0000000..e79a875 --- /dev/null +++ b/src/test/data/lang/cue/inserting_lexer/struct_single.txt @@ -0,0 +1,7 @@ +{ ('{') +IDENTIFIER ('file') +: (':') +WHITE_SPACE (' ') +IDENTIFIER ('string') +} ('}') +, ('') diff --git a/src/test/data/lang/cue/lexer/bottom.cue b/src/test/data/lang/cue/lexer/bottom.cue new file mode 100644 index 0000000..c2da84d --- /dev/null +++ b/src/test/data/lang/cue/lexer/bottom.cue @@ -0,0 +1 @@ +_ & _|_ \ No newline at end of file diff --git a/src/test/data/lang/cue/lexer/bottom.txt b/src/test/data/lang/cue/lexer/bottom.txt new file mode 100644 index 0000000..8f80dc0 --- /dev/null +++ b/src/test/data/lang/cue/lexer/bottom.txt @@ -0,0 +1,5 @@ +IDENTIFIER ('_') +WHITE_SPACE (' ') +& ('&') +WHITE_SPACE (' ') +_|_ ('_|_') diff --git a/src/test/data/lang/cue/lexer/ellipsis.cue b/src/test/data/lang/cue/lexer/ellipsis.cue new file mode 100644 index 0000000..09c9ca6 --- /dev/null +++ b/src/test/data/lang/cue/lexer/ellipsis.cue @@ -0,0 +1 @@ +[...{file: string, schema: (json.#Workflow & {})}] \ No newline at end of file diff --git a/src/test/data/lang/cue/lexer/ellipsis.txt b/src/test/data/lang/cue/lexer/ellipsis.txt new file mode 100644 index 0000000..c81dbc9 --- /dev/null +++ b/src/test/data/lang/cue/lexer/ellipsis.txt @@ -0,0 +1,24 @@ +[ ('[') +... ('...') +{ ('{') +IDENTIFIER ('file') +: (':') +WHITE_SPACE (' ') +IDENTIFIER ('string') +, (',') +WHITE_SPACE (' ') +IDENTIFIER ('schema') +: (':') +WHITE_SPACE (' ') +( ('(') +IDENTIFIER ('json') +. ('.') +IDENTIFIER ('#Workflow') +WHITE_SPACE (' ') +& ('&') +WHITE_SPACE (' ') +{ ('{') +} ('}') +) (')') +} ('}') +] (']') diff --git a/src/test/data/lang/cue/lexer/keywords.cue b/src/test/data/lang/cue/lexer/keywords1.cue similarity index 100% rename from src/test/data/lang/cue/lexer/keywords.cue rename to src/test/data/lang/cue/lexer/keywords1.cue diff --git a/src/test/data/lang/cue/lexer/keywords.txt b/src/test/data/lang/cue/lexer/keywords1.txt similarity index 100% rename from src/test/data/lang/cue/lexer/keywords.txt rename to src/test/data/lang/cue/lexer/keywords1.txt diff --git a/src/test/data/lang/cue/lexer/keywords2.cue b/src/test/data/lang/cue/lexer/keywords2.cue new file mode 100644 index 0000000..7c1dc06 --- /dev/null +++ b/src/test/data/lang/cue/lexer/keywords2.cue @@ -0,0 +1,4 @@ +// keywords may be used as labels +// the parser takes care of it +{if: string} +{if: if} \ No newline at end of file diff --git a/src/test/data/lang/cue/lexer/keywords2.txt b/src/test/data/lang/cue/lexer/keywords2.txt new file mode 100644 index 0000000..69a1990 --- /dev/null +++ b/src/test/data/lang/cue/lexer/keywords2.txt @@ -0,0 +1,17 @@ +LINE_COMMENT ('// keywords may be used as labels') +WHITE_SPACE_NEWLINE ('\n') +LINE_COMMENT ('// the parser takes care of it') +WHITE_SPACE_NEWLINE ('\n') +{ ('{') +KEYWORD ('if') +: (':') +WHITE_SPACE (' ') +IDENTIFIER ('string') +} ('}') +WHITE_SPACE_NEWLINE ('\n') +{ ('{') +KEYWORD ('if') +: (':') +WHITE_SPACE (' ') +KEYWORD ('if') +} ('}') \ No newline at end of file diff --git a/src/test/data/lang/cue/lexer/operators.txt b/src/test/data/lang/cue/lexer/operators.txt index bc87b50..542a9d1 100644 --- a/src/test/data/lang/cue/lexer/operators.txt +++ b/src/test/data/lang/cue/lexer/operators.txt @@ -44,7 +44,7 @@ WHITE_SPACE_NEWLINE ('\n') WHITE_SPACE_NEWLINE ('\n') ? ('?') WHITE_SPACE_NEWLINE ('\n') -OPERATOR ('!') +! ('!') WHITE_SPACE_NEWLINE ('\n') ( ('(') WHITE_SPACE_NEWLINE ('\n') @@ -52,7 +52,7 @@ WHITE_SPACE_NEWLINE ('\n') WHITE_SPACE_NEWLINE ('\n') [ ('[') WHITE_SPACE_NEWLINE ('\n') -OPERATOR ('_|_') +_|_ ('_|_') WHITE_SPACE_NEWLINE ('\n') ) (')') WHITE_SPACE_NEWLINE ('\n') @@ -64,4 +64,4 @@ WHITE_SPACE_NEWLINE ('\n') WHITE_SPACE_NEWLINE ('\n') , (',') WHITE_SPACE_NEWLINE ('\n') -OPERATOR ('.') \ No newline at end of file +. ('.') \ No newline at end of file diff --git a/src/test/data/lang/cue/lexer/struct_int.cue b/src/test/data/lang/cue/lexer/struct_int.cue new file mode 100644 index 0000000..65a7702 --- /dev/null +++ b/src/test/data/lang/cue/lexer/struct_int.cue @@ -0,0 +1 @@ +{key: 0} \ No newline at end of file diff --git a/src/test/data/lang/cue/lexer/struct_int.txt b/src/test/data/lang/cue/lexer/struct_int.txt new file mode 100644 index 0000000..33f6e83 --- /dev/null +++ b/src/test/data/lang/cue/lexer/struct_int.txt @@ -0,0 +1,6 @@ +{ ('{') +IDENTIFIER ('key') +: (':') +WHITE_SPACE (' ') +INT_LIT ('0') +} ('}') diff --git a/src/test/data/lang/cue/lexer/top.cue b/src/test/data/lang/cue/lexer/top.cue new file mode 100644 index 0000000..8eceecd --- /dev/null +++ b/src/test/data/lang/cue/lexer/top.cue @@ -0,0 +1 @@ +_ & 5 \ No newline at end of file diff --git a/src/test/data/lang/cue/lexer/top.txt b/src/test/data/lang/cue/lexer/top.txt new file mode 100644 index 0000000..adfe70f --- /dev/null +++ b/src/test/data/lang/cue/lexer/top.txt @@ -0,0 +1,6 @@ +IDENTIFIER ('_') +WHITE_SPACE (' ') +& ('&') +WHITE_SPACE (' ') +WHITE_SPACE (' ') +INT_LIT ('5') diff --git a/src/test/data/lang/cue/parser/ellipsis.cue b/src/test/data/lang/cue/parser/ellipsis.cue new file mode 100644 index 0000000..75f8b58 --- /dev/null +++ b/src/test/data/lang/cue/parser/ellipsis.cue @@ -0,0 +1,2 @@ +package test +workflows: [...{file: string, schema: (json.#Workflow & {})}] \ No newline at end of file diff --git a/src/test/data/lang/cue/parser/ellipsis.txt b/src/test/data/lang/cue/parser/ellipsis.txt new file mode 100644 index 0000000..c4da663 --- /dev/null +++ b/src/test/data/lang/cue/parser/ellipsis.txt @@ -0,0 +1,52 @@ +FILE + CuePackageClauseImpl(PACKAGE_CLAUSE) + PsiElement(KEYWORD)('package') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('test') + PsiWhiteSpace('\n') + CueFieldImpl(FIELD) + CueLabelImpl(LABEL) + CueLabelExprImpl(LABEL_EXPR) + PsiElement(IDENTIFIER)('workflows') + PsiElement(:)(':') + PsiWhiteSpace(' ') + CueListLitImpl(LIST_LIT) + PsiElement([)('[') + CueEllipsisImpl(ELLIPSIS) + PsiElement(...)('...') + CueStructLitImpl(STRUCT_LIT) + PsiElement({)('{') + CueFieldImpl(FIELD) + CueLabelImpl(LABEL) + CueLabelExprImpl(LABEL_EXPR) + PsiElement(IDENTIFIER)('file') + PsiElement(:)(':') + PsiWhiteSpace(' ') + CueOperandNameImpl(OPERAND_NAME) + PsiElement(IDENTIFIER)('string') + PsiElement(,)(',') + PsiWhiteSpace(' ') + CueFieldImpl(FIELD) + CueLabelImpl(LABEL) + CueLabelExprImpl(LABEL_EXPR) + PsiElement(IDENTIFIER)('schema') + PsiElement(:)(':') + PsiWhiteSpace(' ') + CueOperandImpl(OPERAND) + PsiElement(()('(') + CueBinaryExprImpl(BINARY_EXPR) + CuePrimaryExprImpl(PRIMARY_EXPR) + CueOperandNameImpl(OPERAND_NAME) + PsiElement(IDENTIFIER)('json') + CueSelectorImpl(SELECTOR) + PsiElement(.)('.') + PsiElement(IDENTIFIER)('#Workflow') + PsiWhiteSpace(' ') + PsiElement(&)('&') + PsiWhiteSpace(' ') + CueStructLitImpl(STRUCT_LIT) + PsiElement({)('{') + PsiElement(})('}') + PsiElement())(')') + PsiElement(})('}') + PsiElement(])(']') \ No newline at end of file diff --git a/src/test/data/lang/cue/parser/struct7.cue b/src/test/data/lang/cue/parser/struct7.cue new file mode 100644 index 0000000..079fca6 --- /dev/null +++ b/src/test/data/lang/cue/parser/struct7.cue @@ -0,0 +1,4 @@ +{ + file: "test.yml" + schema: test +}, \ No newline at end of file diff --git a/src/test/data/lang/cue/parser/struct7.txt b/src/test/data/lang/cue/parser/struct7.txt new file mode 100644 index 0000000..d3b9233 --- /dev/null +++ b/src/test/data/lang/cue/parser/struct7.txt @@ -0,0 +1,29 @@ +FILE + CueEmbeddingImpl(EMBEDDING) + CueStructLitImpl(STRUCT_LIT) + PsiElement({)('{') + PsiWhiteSpace('\n') + PsiWhiteSpace(' ') + CueFieldImpl(FIELD) + CueLabelImpl(LABEL) + CueLabelExprImpl(LABEL_EXPR) + PsiElement(IDENTIFIER)('file') + PsiElement(:)(':') + PsiWhiteSpace(' ') + CueSimpleStringLitImpl(SIMPLE_STRING_LIT) + PsiElement(DOUBLE_QUOTE)('"') + PsiElement(UNICODE_VALUE)('test.yml') + PsiElement(DOUBLE_QUOTE_END)('"') + PsiWhiteSpace('\n') + PsiWhiteSpace(' ') + CueFieldImpl(FIELD) + CueLabelImpl(LABEL) + CueLabelExprImpl(LABEL_EXPR) + PsiElement(IDENTIFIER)('schema') + PsiElement(:)(':') + PsiWhiteSpace(' ') + CueOperandNameImpl(OPERAND_NAME) + PsiElement(IDENTIFIER)('test') + PsiWhiteSpace('\n') + PsiElement(})('}') + PsiElement(,)(',') \ No newline at end of file diff --git a/src/test/data/lang/cue/parser/struct8.cue b/src/test/data/lang/cue/parser/struct8.cue new file mode 100644 index 0000000..19c32fe --- /dev/null +++ b/src/test/data/lang/cue/parser/struct8.cue @@ -0,0 +1 @@ +steps: [...(_ & {if: "${{ \(_#isCLCITestBranch) }}"})] \ No newline at end of file diff --git a/src/test/data/lang/cue/parser/struct8.txt b/src/test/data/lang/cue/parser/struct8.txt new file mode 100644 index 0000000..07fd79d --- /dev/null +++ b/src/test/data/lang/cue/parser/struct8.txt @@ -0,0 +1,40 @@ +FILE + CueFieldImpl(FIELD) + CueLabelImpl(LABEL) + CueLabelExprImpl(LABEL_EXPR) + PsiElement(IDENTIFIER)('steps') + PsiElement(:)(':') + PsiWhiteSpace(' ') + CueListLitImpl(LIST_LIT) + PsiElement([)('[') + CueEllipsisImpl(ELLIPSIS) + PsiElement(...)('...') + CueOperandImpl(OPERAND) + PsiElement(()('(') + CueBinaryExprImpl(BINARY_EXPR) + CueOperandNameImpl(OPERAND_NAME) + PsiElement(IDENTIFIER)('_') + PsiWhiteSpace(' ') + PsiElement(&)('&') + PsiWhiteSpace(' ') + CueStructLitImpl(STRUCT_LIT) + PsiElement({)('{') + CueFieldImpl(FIELD) + CueLabelImpl(LABEL) + CueLabelExprImpl(LABEL_EXPR) + PsiElement(IDENTIFIER)('if') + PsiElement(:)(':') + PsiWhiteSpace(' ') + CueSimpleStringLitImpl(SIMPLE_STRING_LIT) + PsiElement(DOUBLE_QUOTE)('"') + PsiElement(UNICODE_VALUE)('${{ ') + CueInterpolationImpl(INTERPOLATION) + PsiElement(\\()('\(') + CueOperandNameImpl(OPERAND_NAME) + PsiElement(IDENTIFIER)('_#isCLCITestBranch') + PsiElement(INTERPOLATION_END)(')') + PsiElement(UNICODE_VALUE)(' }}') + PsiElement(DOUBLE_QUOTE_END)('"') + PsiElement(})('}') + PsiElement())(')') + PsiElement(])(']') \ No newline at end of file diff --git a/src/test/data/lang/cue/parser/struct_int.cue b/src/test/data/lang/cue/parser/struct_int.cue new file mode 100644 index 0000000..65a7702 --- /dev/null +++ b/src/test/data/lang/cue/parser/struct_int.cue @@ -0,0 +1 @@ +{key: 0} \ No newline at end of file diff --git a/src/test/data/lang/cue/parser/struct_int.txt b/src/test/data/lang/cue/parser/struct_int.txt new file mode 100644 index 0000000..c93ed2a --- /dev/null +++ b/src/test/data/lang/cue/parser/struct_int.txt @@ -0,0 +1,13 @@ +FILE + CueEmbeddingImpl(EMBEDDING) + CueStructLitImpl(STRUCT_LIT) + PsiElement({)('{') + CueFieldImpl(FIELD) + CueLabelImpl(LABEL) + CueLabelExprImpl(LABEL_EXPR) + PsiElement(IDENTIFIER)('key') + PsiElement(:)(':') + PsiWhiteSpace(' ') + CueBasicLitImpl(BASIC_LIT) + PsiElement(INT_LIT)('0') + PsiElement(})('}') \ No newline at end of file