Fix examples
This commit is contained in:
parent
182c29c2a7
commit
d68590b5c7
2 changed files with 7 additions and 1 deletions
|
|
@ -514,6 +514,7 @@ FineGrammar=Grammar(
|
||||||
)
|
)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from parser.parser import dump_lexer_table
|
from parser.parser import dump_lexer_table
|
||||||
from parser.emacs import emit_emacs_major_mode
|
from parser.emacs import emit_emacs_major_mode
|
||||||
|
|
@ -530,6 +531,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
# Generate tree-sitter parser and emacs mode.
|
# Generate tree-sitter parser and emacs mode.
|
||||||
ts_path = Path(__file__).parent / "tree-sitter-fine"
|
ts_path = Path(__file__).parent / "tree-sitter-fine"
|
||||||
|
os.makedirs(ts_path, exist_ok=True)
|
||||||
emit_tree_sitter_grammar(grammar, ts_path)
|
emit_tree_sitter_grammar(grammar, ts_path)
|
||||||
emit_tree_sitter_queries(grammar, ts_path)
|
emit_tree_sitter_queries(grammar, ts_path)
|
||||||
emit_emacs_major_mode(grammar, ts_path / "fine.el")
|
emit_emacs_major_mode(grammar, ts_path / "fine.el")
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ def sql():
|
||||||
|
|
||||||
@rule
|
@rule
|
||||||
def schema():
|
def schema():
|
||||||
seq(
|
return seq(
|
||||||
CREATE,
|
CREATE,
|
||||||
SCHEMA,
|
SCHEMA,
|
||||||
AUTHORIZATION,
|
AUTHORIZATION,
|
||||||
|
|
@ -759,3 +759,7 @@ SQL = Grammar(
|
||||||
trivia=[BLANKS, COMMENT, LINE_BREAK],
|
trivia=[BLANKS, COMMENT, LINE_BREAK],
|
||||||
name="SQL",
|
name="SQL",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if __name__=="__main__":
|
||||||
|
tbl = SQL.build_table()
|
||||||
|
print(tbl.format())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue