c++ - recognize start conditions only at one string lex -
i need set token "any character, except beginning of new line". i'm try
[^^]
but not working. firstly, need detect pattern line:
%s arithm secoper number [0-9]+ integer (-?[0-9]+) assign [=] vary [a-za-z][?-i:a-z0-9]{0,15} arithmsigns (\+[ ]*|\-[ ]*|\*[ ]*|\/[ ]*) space [ ]+ spaces [ ]* [^^] %% ^{number}{spaces}{vary}{spaces}{assign}{spaces}({vary}|{integer}) {begin(arithm);} <arithm>{any}{spaces}{arithmsigns}/({vary}|{integer}) {begin(secoper);} <secoper>{vary}|{integer}$ {begin(initial);} %%
so string like
54 firstvar = 43 * newvar
is true, if input is:
54 firstvar = 43 * newvar
(2 strings in c-like stream \n) must error, pattern recognize it. need recognize start conditions @ 1 input line. how can this?
you're doing wrong way. grammar problem, not lexical problem. if newline significant in language should appear explicitly in grammar, , returned token lexer.
Comments
Post a Comment