diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-06-20 18:39:38 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-06-20 18:46:13 +0900 |
commit | 8993406a8ebe8c0a01d5081dc4afcf819e3160d4 (patch) | |
tree | 8940654c0bbc1e200908cafe83813fe7765a5229 /spec/lexer.go | |
parent | Add syntax of comments (diff) | |
download | cotia-8993406a8ebe8c0a01d5081dc4afcf819e3160d4.tar.gz cotia-8993406a8ebe8c0a01d5081dc4afcf819e3160d4.tar.xz |
Add syntax of modifiers and actions
Currently, a mode modifier and push/pop actions are available.
The modifier and the actions make sense in only lexical specifications.
Diffstat (limited to 'spec/lexer.go')
-rw-r--r-- | spec/lexer.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/lexer.go b/spec/lexer.go index 19efd80..18aae51 100644 --- a/spec/lexer.go +++ b/spec/lexer.go @@ -21,6 +21,8 @@ const ( tokenKindColon = tokenKind(":") tokenKindOr = tokenKind("|") tokenKindSemicolon = tokenKind(";") + tokenKindModifierMarker = tokenKind("@") + tokenKindActionLeader = tokenKind("#") tokenKindEOF = tokenKind("eof") tokenKindInvalid = tokenKind("invalid") ) @@ -135,6 +137,10 @@ func (l *lexer) next() (*token, error) { return newSymbolToken(tokenKindOr), nil case "semicolon": return newSymbolToken(tokenKindSemicolon), nil + case "modifier_marker": + return newSymbolToken(tokenKindModifierMarker), nil + case "action_leader": + return newSymbolToken(tokenKindActionLeader), nil default: return newInvalidToken(tok.Text()), nil } |