Hi i'm writing a simple lexer
:- module(lekser, [lekser/3]).
lekser(Tokens) -->
white_space,
(
(
"{", !, { Token = tkLBrace }
; "}", !, { Token = tkRBrace }
; ")", !, { Token = tkRParen }
; "(", !, { Token = tkLParen }
; ";", !, { Token = tkSColon }
; "\", !, { Token = tkLambda }
; "->", !, { Token = tkImpli }
; "<", !, { Token = tkLT }
; ">", !, { Token = tkGT }
; "<=", !, { Token = tkLeq }
; ">=", !, { Token = tkGeq }
; "=", !, { Token = tkAssgn }
; "\=", !, { Token = tkNeq }
; "+", !, { Token = tkPlus }
; "-", !, { Token = tkMinus }
; "*", !, { Token = tkTimes }
; "div", !, { Token = tkDiv }
; "mod", !, { Token = tkMod }
...
...)).
Here is the begining of code whell coudl someone tell me where i made mistake because swi code editor says there is an eror(even after putting only few empty nelines) Syntax error: String too long (see style_check/1)
...
Ok i found out what whas the reason, but i dont know why it works like this editor parse "\"
in some strange way and i have to make it "\""
but then as i perhaps it will not be \ operator but \" how to change it ?
Just to widen my response, Yes, using "\""
you enter exactly an string with a double quote "
. For example:
?- write("\"abc\"").
[34,97,98,99,34]
Note how the string abc
is surrounded by two 34 values (the double quote in ASCII).