feat: temporary grammar
This commit is contained in:
@@ -17,8 +17,8 @@ topLevelStatements:
|
||||
;
|
||||
|
||||
topLevelStatement:
|
||||
contentText
|
||||
| multiDivert
|
||||
multiDivert
|
||||
| contentText
|
||||
;
|
||||
|
||||
knotLevelStatements:
|
||||
@@ -63,7 +63,7 @@ inlineLogic:
|
||||
INLINE_LOGIC_START
|
||||
WS?
|
||||
innerLogic
|
||||
// TODO: += and -= are disabled here (don't know why)
|
||||
// TODO: += and -= are disabled here (don't know why, maybe because they're statements?)
|
||||
WS?
|
||||
INLINE_LOGIC_END
|
||||
// TODO: tags ftw
|
||||
@@ -77,28 +77,47 @@ innerLogic:
|
||||
|
||||
multiDivert:
|
||||
WS?
|
||||
(
|
||||
THREAD_ARROW divertIdentifierWithArguments
|
||||
// here be dragons: trying to express the various "Possible patterns" of InkParser_Divert => MultiDivert
|
||||
| (DIVERT_ARROW divertIdentifierWithArguments)+ TUNNEL_ARROW divertIdentifierWithArguments
|
||||
| (DIVERT_ARROW divertIdentifierWithArguments)+ TUNNEL_ARROW
|
||||
| (DIVERT_ARROW divertIdentifierWithArguments)+ DIVERT_ARROW
|
||||
| TUNNEL_ARROW
|
||||
| DIVERT_ARROW // TODO: this is only valid in default choices ( https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#fallback-choices )
|
||||
)
|
||||
multiDivert_withoutWS
|
||||
;
|
||||
|
||||
multiDivert_withoutWS:
|
||||
THREAD_ARROW divertIdentifierWithArguments # MultiDivertThread
|
||||
// here be dragons: trying to express the various "Possible patterns" of InkParser_Divert => MultiDivert
|
||||
// syntax in the original ink parser is overly concessive: https://discord.com/channels/329929050866843648/329929390358265857/1342130940981284945
|
||||
| (DIVERT_ARROW divertIdentifierWithArguments)* multiDivertArrows_tail # MultiDivertArrows
|
||||
// TODO: a single DIVERT_ARROW above is only valid in default choices ( https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#fallback-choices )
|
||||
// TODO: tags ftw
|
||||
;
|
||||
|
||||
multiDivertArrows_tail:
|
||||
DIVERT_ARROW # MultiDivertArrows_tailDefaultChoice
|
||||
| DIVERT_ARROW divertIdentifierWithArguments # MultiDivertArrows_tailDivert
|
||||
| TUNNEL_ARROW divertIdentifierWithArguments # MultiDivertArrows_tailTunnelWithReplacement
|
||||
| TUNNEL_ARROW # MultiDivertArrows_tailTunnel
|
||||
;
|
||||
|
||||
divertIdentifierWithArguments:
|
||||
WS? identifier WS? ('.' WS? identifier WS? )*
|
||||
WS?
|
||||
divertIdentifierWithArguments_name
|
||||
WS?
|
||||
(
|
||||
'('
|
||||
expression (',' expression)*
|
||||
expression (',' WS? expression)*
|
||||
')'
|
||||
)?
|
||||
WS?
|
||||
;
|
||||
|
||||
divertIdentifierWithArguments_name:
|
||||
WS? identifier WS? ('.' WS? identifier WS? )*
|
||||
;
|
||||
|
||||
divertIdentifierWithArguments_arguments:
|
||||
'('
|
||||
expression (',' WS? expression)*
|
||||
')'
|
||||
;
|
||||
|
||||
identifier:
|
||||
// TODO: reject numbers-only identifier - see InkParser_Logic => Identifier
|
||||
IDENTIFIER
|
||||
|
||||
Reference in New Issue
Block a user