aboutsummaryrefslogtreecommitdiff
path: root/spec/lexspec.json
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-06-14 23:22:02 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-06-15 19:16:58 +0900
commitf16811613aeb79444a3555115e4031f68cd183b9 (patch)
tree3e4207ddd7f331fdcb11c86e2273bcbe262e9d0f /spec/lexspec.json
parentUpdate README (diff)
downloadcotia-f16811613aeb79444a3555115e4031f68cd183b9.tar.gz
cotia-f16811613aeb79444a3555115e4031f68cd183b9.tar.xz
Add spec parser
Currently, the parser only supports definitions of lexical specification.
Diffstat (limited to 'spec/lexspec.json')
-rw-r--r--spec/lexspec.json70
1 files changed, 70 insertions, 0 deletions
diff --git a/spec/lexspec.json b/spec/lexspec.json
new file mode 100644
index 0000000..11c2806
--- /dev/null
+++ b/spec/lexspec.json
@@ -0,0 +1,70 @@
+{
+ "entries": [
+ {
+ "fragment": true,
+ "kind": "lf",
+ "pattern": "\\u{000A}"
+ },
+ {
+ "fragment": true,
+ "kind": "cr",
+ "pattern": "\\u{000D}"
+ },
+ {
+ "fragment": true,
+ "kind": "ht",
+ "pattern": "\\u{0009}"
+ },
+ {
+ "fragment": true,
+ "kind": "sp",
+ "pattern": "\\u{0020}"
+ },
+ {
+ "fragment": true,
+ "kind": "newline",
+ "pattern": "\\f{lf}|\\f{cr}|\\f{cr}\\f{lf}"
+ },
+ {
+ "kind": "white_space",
+ "pattern": "(\\f{ht}|\\f{sp})+"
+ },
+ {
+ "kind": "newline",
+ "pattern": "\\f{newline}"
+ },
+ {
+ "kind": "identifier",
+ "pattern": "[A-Za-z_][0-9A-Za-z_]*"
+ },
+ {
+ "kind": "terminal_open",
+ "pattern": "\"",
+ "push": "terminal"
+ },
+ {
+ "modes": ["terminal"],
+ "kind": "pattern",
+ "pattern": "([^\"\\\\]|\\\\.)+"
+ },
+ {
+ "modes": ["terminal"],
+ "kind": "escape_symbol",
+ "pattern": "\\\\"
+ },
+ {
+ "modes": ["terminal"],
+ "kind": "terminal_close",
+ "pattern": "\"",
+ "pop": true
+ },
+ {
+ "kind": "colon",
+ "pattern": ":"
+ },
+ {
+ "kind": "semicolon",
+ "pattern": ";"
+ }
+ ]
+}