A comment and an escape sequence (such as a string literal) are very exclusive to the regular symbolic representation.
I find it difficult to understand how regular lexical analyzers symbolize them. How do lexical analyzers such as lex, flexor the like , process such characters? Is there a general method? Or just in each case for each language?
lex
flex
, - - . , lexer . , C, \" lexer .flex . ., C ( /* */) flex texinfo:
\"
/*
*/
<INITIAL>"/*" BEGIN(IN_COMMENT); <IN_COMMENT>{ "*/" BEGIN(INITIAL); [^*\n]+ /* eat comment in chunks */ "*" /* eat the lone star */ \n yylineno++; }
. , C, start " " FAQ escape- C? flex texinfo., .
escape- (, ) .
, , , , . ( ), escape- .
, escape-, \\, \", \n \r, ( E):
\\
\n
\r
E
E -> \ S S -> \ S -> " S -> n S -> r …
escape- (.. , ).
lex, ( ++ style/comments) (, , Python), , //, .