Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Newline terminated slot values #3

Open
wants to merge 3 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
8 changes: 4 additions & 4 deletions src/com/slalom/aws/avs/sutr/Sutr.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ file_name ::= NAME
custom_type ::= 'slotType' type_name custom_type_items
{extends="com.slalom.aws.avs.sutr.psi.impl.SutrReferenceImpl" implements="com.slalom.aws.avs.sutr.psi.SutrTypeDefinitionReference" }

custom_type_items ::= LS custom_type_item (',' custom_type_item)* RS {pin=1}
custom_type_item ::= (NAME|WORD)
custom_type_items ::= LS (custom_type_item)* RS {pin=1}
custom_type_item ::= PHRASE

literal_type ::= 'literal' type_name literal_phrases
{extends="com.slalom.aws.avs.sutr.psi.impl.SutrReferenceImpl" implements="com.slalom.aws.avs.sutr.psi.SutrTypeDefinitionReference" }

literal_phrases ::= LS literal_phrase (',' literal_phrase )* RS {pin=1}
literal_phrase ::= (NAME|WORD)*
literal_phrases ::= LS (literal_phrase)* RS {pin=1}
literal_phrase ::= PHRASE

object ::= 'def' sutr_name sutr_params body function_pointer {pin=3}

Expand Down
14 changes: 11 additions & 3 deletions src/com/slalom/aws/avs/sutr/_SutrLexer.flex
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ LINE_WS=[\ \t\f]
WHITE_SPACE=({LINE_WS}|{EOL})+

COMMENT=#[^\r\n]*

PHRASE=[a-zA-Z0-9' ]+
WORD=[a-zA-Z']+
NAME=[a-zA-Z]+
IDENTIFIER=[a-zA-Z_]+
FUNCTION_IDENTIFIER=[a-zA-Z_\.]+

%state YYSUTR
%state YYSUTR_PHRASES
%%
<YYINITIAL> {
{WHITE_SPACE} { return com.intellij.psi.TokenType.WHITE_SPACE; }
Expand All @@ -48,8 +49,8 @@ FUNCTION_IDENTIFIER=[a-zA-Z_\.]+
"}" { return SutrRB; }
"(" { return SutrLP; }
")" { return SutrRP; }
"[" { return SutrLS; }
"]" { return SutrRS; }
"[" { yybegin(YYSUTR_PHRASES); return SutrLS; }
"]" { yybegin(YYSUTR); return SutrRS; }
"," { return SutrCOMMA; }
{NAME} { return SutrNAME; }
{IDENTIFIER} { return SutrIDENTIFIER; }
Expand All @@ -69,4 +70,11 @@ FUNCTION_IDENTIFIER=[a-zA-Z_\.]+
"=>" { yybegin(YYINITIAL); return SutrFP; }
}

<YYSUTR_PHRASES> {
{WHITE_SPACE} { return com.intellij.psi.TokenType.WHITE_SPACE; }
"]" { yybegin(YYINITIAL); return SutrRS; }
{COMMENT} { return SutrCOMMENT; }
{PHRASE} { return SutrPHRASE; }
}

[^] { return com.intellij.psi.TokenType.BAD_CHARACTER; }
165 changes: 89 additions & 76 deletions src/com/slalom/aws/avs/sutr/_SutrLexer.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.