diff --git a/src/utilities/codemirror/satf/satf-sasf.grammar b/src/utilities/codemirror/satf/satf-sasf.grammar new file mode 100644 index 0000000000..f95ef9b9bf --- /dev/null +++ b/src/utilities/codemirror/satf/satf-sasf.grammar @@ -0,0 +1,418 @@ +@top satf_sasf { + Satf | Sasf + } + + Satf{ + newLine? + Header newLine? + Body {ActivityTypeDefinitions?} + (eof newLine?) + } + + Sasf{ + newLine? + Header newLine? + eod newLine? + Body { Requests* } + (eof newLine?) + } + + Header { + (SfduHeader newLine?)? + (SeqHeader newLine?)? + eoh + } + + HeaderPairs { HeaderPair* } + HeaderPair {Key"="Value ";" newLine} + Key { identifier } + Value { headerValue+ } + SfduHeader { headerMarker newLine HeaderPairs headerMarker} + + Start { "$$"identifier identifier* newLine} + LineSeparator { "**" ("*" | "**")+ newLine} + Keyword { identifier } + Data { anyASCII+ } + HeaderRecords { HeaderRecord+ } + HeaderRecord { "*"Keyword Data? newLine} + SeqHeader { Start LineSeparator HeaderRecords? LineSeparator } + + ActivityTypeDefinitions { ActivityTypeGroup (ActivityTypeGroup)* } + ActivityTypeGroup { + identifier parentheses< + newLine?"`"? + definitions + ( + Parameters{input} | + Variables{ input} + )* + Steps? + > + newLine? + } + + Requests { Request ("," Request)? } + + RequestName {identifier} + Request { request parentheses< + newLine? + definition + definitionUnslashValuedefinitionUnslashValue + (definitionUnslashValuedefinitionUnslashValue | + definitionUnslashValue definitionUnslashValue? | + definitionUnslashValue definitionUnslashValue)* + > + Steps{newLine? step+ end}? +} + + definition { content definitionEnd?} + // StartTag[closedBy="EndTag"] { "\\" } + // EndTag[openedBy="StartTag"] { "\\" } + definitionValue {"\\" content "\\" definitionEnd?} + definitionUnslashValue {content definitionEnd?} + definitionEnd { "," | (newLine? ",") | ("," newLine?) | newLine } + + definitions { + (definition (definitionValue | definitionUnslashValue)) + ((definition (definitionValue | definitionUnslashValue)) | + (definition (definitionValue | definitionUnslashValue)) | + (definition definitionValue) | + (definition definitionValue) | + (definition (definitionValue | definitionUnslashValue) ) | + (definition (definitionValue | definitionUnslashValue)) | + (definition (definitionValue | definitionUnslashValue)))* + } + ActivityTypeName { path } + ActivityTypeCode { identifier } + ReturnType { identifier } + Flags { Flag+ } + Flag { identifier | ("|" identifier) } //todo + Help { (anyASCII | newLine)+ } + SeqgenText { anyASCII } + VirtualChannel { identifier} + OnBoardFilename { path } + OnBoardPath { path } + + + input { category "," newLine? (entry newLine?)+ end newLine?} + Entry { Name { identifier } parentheses + < + newLine? + paramterKeyValue | definitionUnslashValue)> + (paramterKeyValue | definitionUnslashValue)> | + ranges | + paramterKeyValue | definitionUnslashValue)> | + paramterKeyValue | definitionUnslashValue )> | + paramterKeyValue>)* + > + } + + paramterKeyValue { key "," value} + + Type { identifier (("[" singleDigit* "]") | "[]")? } + EnumName {identifier} + Range { anyASCII+ } + ranges {(paramterKeyValue>) } + Prefix { "YES" | "NO" } + Default { anyASCII } + + Steps { stepsKeyword "," newLine? step+ end } + step { Command | Ground | CommandDynamic | Note | Activity | Loop | Assignment } // | + + Command { + command + parentheses< + commonFields + stepFields{ + definitionUnslashValue< + Stem{identifier} + parentheses< + Args< + String | Number | Enum | Global | Arithmetical + >? + >? + >? + (definition definitionUnslashValue? end)? + } + > + newLine? + } + + CommandDynamic { + commandDynamic + parentheses< + commonFields + stepFields { + definitionUnslashValue< + Stem{"\""identifier"\""} + parentheses< + Args< + String | Number | Enum | Global | Expression | Arithmetical + >? + >? + >? + (definition definitionUnslashValue? end) + } + > + newLine? + } + + Note { + note + parentheses< + commonFields + stepFields{ + definitionUnslashValue< + Stem{ definition<"TEXT">} + Args{Expression} newLine? + > + } + > + newLine? + } + + Activity { + activity + parentheses< + commonFields + stepFields{ + Group + } + > + newLine? + } + + Loop { + loop + parentheses< + commonFields + stepFields{ + definition + definitionValue + } + > + newLine? + Steps{Command+} + EndLoop{"end_loop"} + parentheses< + commonFields + > + newLine? + } + + Count{ anyASCII+ } + + Assignment { + assignment + parentheses< + commonFields + stepFields{ + definition + definitionValue< + Args< + String | Number | Enum | Global | Expression | Arithmetical + > + > + } + > + newLine? + } + + Ground { + ground + parentheses< + commonFields + stepFields{ + definitionUnslashValue< + Stem{identifier} + parentheses< + Args< + String | Number | Enum | Global | Arithmetical + >? + >? + >? + (definition definitionUnslashValue? end)? + } + > + newLine? + } + + commonFields { + definitionUnslashValue + ScheduledTime + ((definition definitionValue) | + (definition (definitionValue | definitionUnslashValue )) | + (definition definitionValue) | + (definition definitionValue))* + + } + + parentheses { "(" newLine? expression (~newLine)? (")" | "),")} + StepLabel { singleDigit+ ("."singleDigit+)? } + ScheduledTime { definition<"SCHEDULED_TIME"> (definitionValue | definitionUnslashValue) TimeRelation{identifier} newLine? ","? newLine? } + InclusionCondition {anyASCII+} + AssumedModelValues{ Model (","Model)* } + Model { Key"="Value{modelValue+} } + Draw { "VERTICAL" | "HORIZONTAL" | "HATCHED" | "STANDARD" | "DIAGONAL" } + Comment { (anyASCII | newLine)+ } + Enum { identifier } + Arithmetical { identifier "+" identifier} + Args { args newLine? ("," newLine? args)* } + Expression {"\\"anyASCII+"\\"} + Processors {string} + String { string } + Label { string } + Opcode { string } + Pars { string } + + Group{ + ( + TypeGroup{identifier} + parentheses< + definition + Args< + String | Number | Enum | Expression + >? + > + newLine? + ) | ( + TypeGroup{seqgenDirective} + parentheses< + (definition Filename{string}) | + (definition Name{string}?) | + (definition definition definition definition ) + > + newLine? + ) | ( + TypeGroup{seqTranSet} + parentheses< + definition + definition