mirror of
https://github.com/IvarK/AntimatterDimensionsSourceCode.git
synced 2024-11-10 06:02:13 +00:00
13
Automator EBNF
cyip92 edited this page 2023-07-17 11:44:20 -05:00
This wiki entry is meant for people who wish to understand or edit the way the Automator interprets script text. The in-game code for how the Automator uses/implements this specification can be found across the following files:
core/automator/lexer.js
- Definition of all tokenscore/automator/parser.js
- Definition of some intermediate strings, made from specific token combinations (eg. time study strings)core/automator/automator-commands.js
- Definition of top-level rules (as well as actual command behavior - irrelevant for this wiki entry)
For people who don't know what EBNF is, or who have troubles reading it, try this http://www.bottlecaps.de/rr/ui. Paste into "Edit Grammar" and then switch to "View Diagram". This will produce a series of smaller railroad diagrams which describe the program flow as the Automator scans through script text.
A few notes:
- The 'Preset' terminal is encoded as
'name' ( ' ' | '\t' )+ [^\s#/]*
, even though the actual regex pattern for it is/name([ \t]+(\/(?!\/)|[^\s#/])*)?/i
, because I'm not sure how to encode the Negative Lookahead(?!\/)
in EBNF. (This is specific to the above note on the railroad diagrams) - Space Theorems are defined as the entire string
space theorems
instead ofst
because otherwise the rules would need to be restructured to get aroundst
being a prefix ofstart
.
Script ::= Block
Block ::= EOL? Command ( EOL Command )* EOL?
Command ::= AutoCommand | BlackHoleCommand | BlobCommand | Comment | DefineCommand | PauseTimeCommand | PrestigeCommand | StartDilationCommand | StartECCommand | StoreTimeCommand | StopCommand | StudiesBuyCommand | StudiesLoadCommand | StudiesRespecCommand | TTCommand | UnlockDilationCommand | UnlockECCommand | WaitCommand | UntilCommand | WhileCommand | IfCommand
AutoCommand ::= Auto PrestigeEvent ( On | Off | Duration | XHighestAmount | CurrencyAmount )
BlackHoleCommand ::= BlackHole ( On | Off )
BlobCommand ::= Blob
DefineCommand ::= Define Identifier EqualSign ( Duration | StudyList )
IfCommand ::= If Comparison LCurly EOL Block RCurly
NotifyCommand ::= Notify StringLiteral
PauseTimeCommand ::= Pause ( Duration | Identifier )
PrestigeCommand ::= PrestigeEvent ( Respec )? ( NoWait )?
StartDilationCommand ::= Start Dilation
StartECCommand ::= Start EternityChallenge
StoreTimeCommand ::= StoreTime ( On | Off | Use )
StopCommand ::= Stop
StudiesBuyCommand ::= Studies ( NoWait )? Purchase ( StudyList | Identifier )
StudiesLoadCommand ::= Studies ( NoWait )? Load Preset
StudiesRespecCommand ::= Studies Respec
TTCommand ::= TT TTCurrency
UnlockDilationCommand ::= Unlock ( NoWait )? Dilation
UnlockECCommand ::= Unlock ( NoWait )? EternityChallenge
WaitCommand ::= Wait ( Comparison | PrestigeEvent | BlackHoleEvent )
UntilCommand ::= Until ( Comparison | PrestigeEvent ) LCurly EOL Block RCurly
WhileCommand ::= While Comparison LCurly EOL Block RCurly
Comparison ::= CompareValue ComparisonOperator CompareValue
CompareValue ::= NumberLiteral | Identifier | Currency
Duration ::= NumberLiteral TimeUnit
EternityChallenge ::= EC NumberLiteral | ECLiteral
StudyList ::= ( StudyListEntry )+ ( Pipe ECNumber )?
StudyListEntry ::= ( StudyRange | NumberLiteral | StudyPath ) Comma?
StudyRange ::= NumberLiteral Dash NumberLiteral
XHighestAmount ::= NumberLiteral XHighest
CurrencyAmount ::= NumberLiteral Currency
EOL ::= ( ' ' | '\t' | '\r' )* '\n' '\s'*
ComparisonOperator ::= OpGTE | OpLTE | OpGT | OpLT | OpEQ | EqualSign
OpGTE ::= '>='
OpLTE ::= '<='
OpGT ::= '>'
OpLT ::= '<'
OpEQ ::= '=='
LCurly ::= '{'
RCurly ::= '}'
Comma ::= ','
EqualSign ::= '='
Pipe ::= '|'
Dash ::= '-'
NumberLiteral ::= ( '0' | '-'? [1-9] [0-9]* ) ( '.' [0-9]+ )? ( 'e' [+-]? [0-9]+ )?
StringLiteral ::= ( '"' [^\n] '"' | "'" [^\n] "'" )
ECNumber ::= [1-9] [0-9]*
Currency ::= AM | IP | EP | DT | TP | RG | RM | PendingIP | PendingEP | PendingRM | GlyphLevel | Rep | TT | TotalTT | TotalCompletions | PendingCompletions | ECXCompletions | FilterScore
AM ::= 'am'
IP ::= 'ip'
EP ::= 'ep'
DT ::= 'dt'
TP ::= 'tp'
RG ::= 'rg'
RM ::= 'rm'
PendingIP ::= 'pending' ( ' ' | '\t' )+ 'ip'
PendingEP ::= 'pending' ( ' ' | '\t' )+ 'ep'
PendingRM ::= 'pending' ( ' ' | '\t' )+ 'rm'
GlyphLevel ::= 'glyph' ( ' ' | '\t' )+ 'level'
Rep ::= 'rep' | 'replicanti'
TT ::= 'tt'
TotalTT ::= 'total tt'
TotalCompletions ::= 'total' ( ' ' | '\t' )+ 'completions'
PendingCompletions ::= 'pending' ( ' ' | '\t' )+ 'completions'
ECXCompletions ::= 'ec' ECNumber ' completions'
ECLiteral ::= 'ec' ECNumber
FilterScore ::= 'filter' ( ' ' | '\t' )+ 'score'
ST ::= 'space' ( ' ' | '\t' )+ 'theorems'
Auto ::= 'auto'
Buy ::= 'buy'
Blob ::= 'blob'
Define ::= 'define'
If ::= 'if'
Load ::= 'load'
Purchase ::= 'purchase'
Max ::= 'max'
Nowait ::= 'nowait'
Notify ::= 'notify'
Off ::= 'off'
On ::= 'on'
Pause ::= 'pause'
Preset ::= ( 'name' ( ' ' | '\t' )+ [^\s#/]* | 'id' ( ' ' | '\t' )+ '\d' )
Respec ::= 'respec'
Restart ::= 'restart'
Start ::= 'start'
Stop ::= 'stop'
Studies ::= 'studies'
Unlock ::= 'unlock'
Until ::= 'until'
Use ::= 'use'
Wait ::= 'wait'
While ::= 'while'
BlackHole ::= 'black' ( ' ' | '\t' )+ 'hole'
StoreTime ::= 'store' ( ' ' | '\t' )+ 'time'
Dilation ::= 'dilation'
EC ::= 'ec'
XHighest ::= 'x highest'
PrestigeEvent ::= Infinity | Eternity | Reality
BlackHoleEvent ::= BlackHole ( 'off' | 'bh1' | 'bh2' )
Infinity ::= 'infinity'
Eternity ::= 'eternity'
Reality ::= 'reality'
StudyPath ::= Antimatter | Infinity | Time | Active | Passive | Idle
Antimatter ::= 'antimatter'
Time ::= 'time'
Active ::= 'active'
Passive ::= 'passive'
Idle ::= 'idle'
TTCurrency ::= AM | IP | EP | Max
TimeUnit ::= Milliseconds | Seconds | Minutes | Hours
Milliseconds ::= 'ms'
Seconds ::= 's' ( 'ec' ( 'ond' ( 's' )? )? )?
Minutes ::= 'm' ( 'in' ( 'ute' ( 's' )? )? )?
Hours ::= 'h' ( 'our' ( 's' )? )?
Identifier ::= [a-z] [a-z0-9]*
Comment ::= ( '#' | '//' ) [^\n]