Revision f3d244c1
Added by Xavier Thirioux about 8 years ago
src/lexer_lustre.mll | ||
---|---|---|
73 | 73 |
try |
74 | 74 |
let ann = LexerLustreSpec.annot s in |
75 | 75 |
ANNOT ann |
76 |
with LexerLustreSpec.Error loc -> raise (Parse.Error (Location.shift (Location.curr lexbuf) loc, Annot_error s)) |
|
76 |
with LexerLustreSpec.Error loc -> raise (Parse.Error (Location.shift (Location.curr lexbuf) loc, Parse.Annot_error s))
|
|
77 | 77 |
|
78 | 78 |
let make_spec lexbuf s = |
79 | 79 |
try |
80 | 80 |
let ns = LexerLustreSpec.spec s in |
81 | 81 |
NODESPEC ns |
82 |
with LexerLustreSpec.Error loc -> raise (Parse.Error (Location.shift (Location.curr lexbuf) loc, Node_spec_error s)) |
|
82 |
with LexerLustreSpec.Error loc -> raise (Parse.Error (Location.shift (Location.curr lexbuf) loc, Parse.Node_spec_error s))
|
|
83 | 83 |
|
84 | 84 |
} |
85 | 85 |
|
... | ... | |
157 | 157 |
| "^" {POWER} |
158 | 158 |
| '"' {QUOTE} |
159 | 159 |
| eof { EOF } |
160 |
| _ { raise (Parse.Error (Location.curr lexbuf, Undefined_token (Lexing.lexeme lexbuf))) } |
|
160 |
| _ { raise (Parse.Error (Location.curr lexbuf, Parse.Undefined_token (Lexing.lexeme lexbuf))) }
|
|
161 | 161 |
|
162 | 162 |
and comment n = parse |
163 | 163 |
| eof |
164 |
{ raise (Parse.Error (Location.curr lexbuf, Unfinished_comment)) } |
|
164 |
{ raise (Parse.Error (Location.curr lexbuf, Parse.Unfinished_comment)) }
|
|
165 | 165 |
| "(*" |
166 | 166 |
{ comment (n+1) lexbuf } |
167 | 167 |
| "*)" |
... | ... | |
177 | 177 |
| _ as c { Buffer.add_char buf c; annot_singleline lexbuf } |
178 | 178 |
|
179 | 179 |
and annot_multiline n = parse |
180 |
| eof { raise (Parse.Error (Location.curr lexbuf, Unfinished_annot)) } |
|
180 |
| eof { raise (Parse.Error (Location.curr lexbuf, Parse.Unfinished_annot)) }
|
|
181 | 181 |
| "*)" as s { |
182 | 182 |
if n > 0 then |
183 | 183 |
(Buffer.add_string buf s; annot_multiline (n-1) lexbuf) |
... | ... | |
193 | 193 |
| _ as c { Buffer.add_char buf c; spec_singleline lexbuf } |
194 | 194 |
|
195 | 195 |
and spec_multiline n = parse |
196 |
| eof { raise (Parse.Error (Location.curr lexbuf, Unfinished_node_spec)) } |
|
196 |
| eof { raise (Parse.Error (Location.curr lexbuf, Parse.Unfinished_node_spec)) }
|
|
197 | 197 |
| "*)" as s { if n > 0 then |
198 | 198 |
(Buffer.add_string buf s; spec_multiline (n-1) lexbuf) |
199 | 199 |
else |
Also available in: Unified diff
...