首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在flex/lex中声明标识符?

如何在flex/lex中声明标识符?
EN

Stack Overflow用户
提问于 2012-06-29 22:19:34
回答 1查看 2.4K关注 0票数 1

我想创建一个基于flex的CSS2.1词法扫描器。在w3 org上有scanner flex实现。我试着给你打电话

代码语言:javascript
复制
$ flex css2.1.flex
$ gcc lex.yy.c -lfl

但是会出现错误:

代码语言:javascript
复制
css2.1.flex: In function ‘yylex’:
css2.1.flex:53:9: error: ‘S’ undeclared (first use in this function)
css2.1.flex:53:9: note: each undeclared identifier is reported only once for each function it appears in
css2.1.flex:58:9: error: ‘CDO’ undeclared (first use in this function)
css2.1.flex:59:9: error: ‘CDC’ undeclared (first use in this function)
css2.1.flex:60:9: error: ‘INCLUDES’ undeclared (first use in this function)
css2.1.flex:61:9: error: ‘DASHMATCH’ undeclared (first use in this function)
css2.1.flex:63:9: error: ‘STRING’ undeclared (first use in this function)
css2.1.flex:64:9: error: ‘BAD_STRING’ undeclared (first use in this function)
css2.1.flex:66:9: error: ‘IDENT’ undeclared (first use in this function)
css2.1.flex:68:9: error: ‘HASH’ undeclared (first use in this function)
css2.1.flex:70:9: error: ‘IMPORT_SYM’ undeclared (first use in this function)
css2.1.flex:71:9: error: ‘PAGE_SYM’ undeclared (first use in this function)
css2.1.flex:72:9: error: ‘MEDIA_SYM’ undeclared (first use in this function)
css2.1.flex:73:9: error: ‘CHARSET_SYM’ undeclared (first use in this function)
css2.1.flex:75:9: error: ‘IMPORTANT_SYM’ undeclared (first use in this function)
css2.1.flex:77:9: error: ‘EMS’ undeclared (first use in this function)
css2.1.flex:78:9: error: ‘EXS’ undeclared (first use in this function)
css2.1.flex:79:9: error: ‘LENGTH’ undeclared (first use in this function)
css2.1.flex:85:9: error: ‘ANGLE’ undeclared (first use in this function)
css2.1.flex:88:9: error: ‘TIME’ undeclared (first use in this function)
css2.1.flex:90:9: error: ‘FREQ’ undeclared (first use in this function)
css2.1.flex:92:9: error: ‘DIMENSION’ undeclared (first use in this function)
css2.1.flex:94:9: error: ‘PERCENTAGE’ undeclared (first use in this function)
css2.1.flex:95:9: error: ‘NUMBER’ undeclared (first use in this function)
css2.1.flex:97:9: error: ‘URI’ undeclared (first use in this function)
css2.1.flex:99:9: error: ‘BAD_URI’ undeclared (first use in this function)
css2.1.flex:101:9: error: ‘FUNCTION’ undeclared (first use in this function)

我必须如何声明缺少的标识符?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-07-02 17:00:03

它们是从解析器定义中定义的,紧跟在链接上的flex语法之前。当您在解析器定义上运行诸如bison -d之类的命令时,它将生成一个包含定义的文件(通常为y.tab.h)。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11263497

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档