feat: first chunk of lexer/parser translation.
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
lexer grammar InkBlotAntlrLexer;
|
||||
|
||||
Whitespace: [ \t]+ ;
|
||||
// classic "white space" and "new line" - ink's new line also allows for some whitespace at start
|
||||
WS: [ \t]+ ;
|
||||
NL: WS? '\r'? '\n' ;
|
||||
|
||||
// one or more (potential whitespace followed by) newline(s); used e.g. for block sequencing
|
||||
MULTILINE_WS: NL+ ;
|
||||
|
||||
// see InkParser_Content.cs, ContentTextNoEscape and ContentTextAllowingEcapeChar for the escape case
|
||||
// this works for the base case where we're not parsing a string, nor a choice
|
||||
@@ -19,4 +24,24 @@ CONTENT_TEXT_NO_ESCAPE_SIMPLE:
|
||||
| '-' { InputStream.LA(1) != '>' }?
|
||||
// same for threads (<-) and glue (<>)
|
||||
| '<' { InputStream.LA(1) != '-' && InputStream.LA(1) != '>' }?
|
||||
)+ ;
|
||||
)+ ;
|
||||
|
||||
INLINE_LOGIC_START: '{' ;
|
||||
INLINE_LOGIC_END: '}' ;
|
||||
|
||||
// All symbols for sequencing: either using the short-hand symbols (https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#types-of-alternatives)
|
||||
// or using the multiline blocks (https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#multiline-blocks)
|
||||
SEQUENCE_TYPE_SYMBOL_ANNOTATION: [!&~$ ] ;
|
||||
ONCE: 'once' WS? ':' ;
|
||||
CYCLE: 'cycle' WS? ':' ;
|
||||
SHUFFLE: 'shuffle' WS? ':' ;
|
||||
STOPPING: 'stopping' WS? ':' ;
|
||||
SHUFFLE_ONCE: 'shuffle' WS 'once' WS? ':' ;
|
||||
SHUFFLE_STOPPING: 'shuffle' WS 'stopping' WS? ':' ;
|
||||
|
||||
THREAD_ARROW: '<-' ;
|
||||
DIVERT_ARROW: '->' ;
|
||||
TUNNEL_ARROW: '->->' ;
|
||||
|
||||
// TODO: add all extra character ranges from InkParser_CharacterRanges (LatinBasic, LatinExtendedA, ...)
|
||||
IDENTIFIER: [A-Za-z0-9_]+;
|
||||
Reference in New Issue
Block a user