Просмотр исходного кода

fixed lark.lark requiring newline at the end of grammars

lark.lark didn't parse grammars that didn't have a trailing newline in the file, but lark itself has no problem parsing those grammars
this change makes lark.lark more accurate in reflecting what grammars are parsed by lark.
tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.10.0
starwarswii 4 лет назад
committed by starwarswii
Родитель
Сommit
082e0f3de7
1 измененных файлов: 6 добавлений и 6 удалений
  1. +6
    -6
      examples/lark.lark

+ 6
- 6
examples/lark.lark Просмотреть файл

@@ -1,20 +1,20 @@
start: (_item | _NL)*
start: (_item? _NL)* _item?

_item: rule
| token
| statement

rule: RULE rule_params priority? ":" expansions _NL
token: TOKEN token_params priority? ":" expansions _NL
rule: RULE rule_params priority? ":" expansions
token: TOKEN token_params priority? ":" expansions

rule_params: ["{" RULE ("," RULE)* "}"]
token_params: ["{" TOKEN ("," TOKEN)* "}"]

priority: "." NUMBER

statement: "%ignore" expansions _NL -> ignore
| "%import" import_path ["->" name] _NL -> import
| "%import" import_path name_list _NL -> multi_import
statement: "%ignore" expansions -> ignore
| "%import" import_path ["->" name] -> import
| "%import" import_path name_list -> multi_import
| "%declare" name+ -> declare

!import_path: "."? name ("." name)*


Загрузка…
Отмена
Сохранить