Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Compiler construction “的含义\\&引用;flex扫描生成器_Compiler Construction_Flex Lexer_Lexical Analysis - Fatal编程技术网

Compiler construction “的含义\\&引用;flex扫描生成器

Compiler construction “的含义\\&引用;flex扫描生成器,compiler-construction,flex-lexer,lexical-analysis,Compiler Construction,Flex Lexer,Lexical Analysis,我正在读flex手册的一部分。以下是本页给出的示例的一部分: <str>\n { /* error - unterminated string constant */ /* generate error message */ } ... <str>\\n *string_buf_ptr++ = '\n'; ... \n{ /*错误-未终止的字符串常量*/ /

我正在读flex手册的一部分。以下是本页给出的示例的一部分:

<str>\n        {
                 /* error - unterminated string constant */
                 /* generate error message */
               }
...
<str>\\n  *string_buf_ptr++ = '\n';
...
\n{
/*错误-未终止的字符串常量*/
/*生成错误消息*/
}
...
\\n*string_buf_ptr++='\n';
...
\n\\n之间有什么区别

感谢您的帮助

  • \n
    匹配换行符(通常为
    Ox0A
    )。如果在到达换行符之前未终止C样式带引号的字符串,则该规则将触发,并将其视为错误
  • \\n
    匹配一个反斜杠,后跟字母
    n
    。如果带引号的字符串包含两个字符的序列
    \n
    ,则会触发该规则,并将其替换为单个换行符。(其他六个C样式的字母转义序列也应该有规则,
    \a
    \b
    \f
    \r
    \t
    ,和
    \v
    ——每一个都用适当的控制字符替换——但由于我无法证明的原因,其中两个丢失了。)

该页面包含上述6项中的5项<代码>\v很少使用,很容易被忽略。