File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ use nom_rule::rule;
1717
1818use crate :: ast:: * ;
1919use crate :: parser:: common:: * ;
20+ use crate :: parser:: error:: Error ;
21+ use crate :: parser:: error:: ErrorKind ;
2022use crate :: parser:: expr:: * ;
2123use crate :: parser:: input:: Input ;
2224use crate :: parser:: statement:: * ;
@@ -157,6 +159,22 @@ pub fn script_stmts(i: Input) -> IResult<Vec<ScriptStatement>> {
157159}
158160
159161pub fn script_stmt ( i : Input ) -> IResult < ScriptStatement > {
162+ if let Some ( token) = i. tokens . first ( ) {
163+ let kind = token. kind ;
164+ if matches ! (
165+ kind,
166+ END
167+ | ELSE
168+ | ELSEIF
169+ | WHEN
170+ | UNTIL
171+ ) {
172+ return Err ( nom:: Err :: Error ( Error :: from_error_kind (
173+ i,
174+ ErrorKind :: Other ( "block terminator" ) ,
175+ ) ) ) ;
176+ }
177+ }
160178 let let_var_stmt = map (
161179 rule ! {
162180 LET ~ #declare_var
You can’t perform that action at this time.
0 commit comments