`
deepfuture
  • 浏览: 4398015 次
  • 性别: Icon_minigender_1
  • 来自: 湛江
博客专栏
073ec2a9-85b7-3ebf-a3bb-c6361e6c6f64
SQLite源码剖析
浏览量:80055
1591c4b8-62f1-3d3e-9551-25c77465da96
WIN32汇编语言学习应用...
浏览量:69999
F5390db6-59dd-338f-ba18-4e93943ff06a
神奇的perl
浏览量:103292
Dac44363-8a80-3836-99aa-f7b7780fa6e2
lucene等搜索引擎解析...
浏览量:285632
Ec49a563-4109-3c69-9c83-8f6d068ba113
深入lucene3.5源码...
浏览量:15001
9b99bfc2-19c2-3346-9100-7f8879c731ce
VB.NET并行与分布式编...
浏览量:67497
B1db2af3-06b3-35bb-ac08-59ff2d1324b4
silverlight 5...
浏览量:32099
4a56b548-ab3d-35af-a984-e0781d142c23
算法下午茶系列
浏览量:45965
社区版块
存档分类
最新评论

coco/r笔记-扫描器的字符规则定义

 
阅读更多

扫描器的字符规则定义

Scanner Specification
A scanner has to read source text, skip meaningless characters, recognize tokens and
pass them to the parser. This is described in a scanner specification, which consists of
five optional parts:
ScannerSpecification =
["IGNORECASE"]
["CHARACTERS" {SetDecl}]
["TOKENS" {TokenDecl}]
["PRAGMAS" {PragmaDecl}]
{CommentDecl}
{WhiteSpaceDecl}.
2.3.1 Character sets
This section allows the user to declare character sets such as letters or digits. Their
names can then be used in the other sections of the scanner specification. Coco/R
supports the Unicode character set (UTF-8-encoded).
SetDecl = ident '=' Set '.'.
Set = BasicSet {('+'|'-') BasicSet}.
BasicSet = string | ident | char [".." char] | "ANY".
SetDecl associates a name with a character set. Basic character sets are denoted as:
string a set consisting of all the characters in the string
ident a previously declared character set with this name
char a set containing the character char
char1..char2 the set of all characters from char1 to char2
ANY the set of all characters in the range 0 .. 65535
Character sets may be formed from basic sets using the operators
+ set union
- set difference
Examples
digit = "0123456789". /* the set of all digits */
hexDigit = digit + "ABCDEF". /* the set of all hexadecimal digits */
letter = 'A' .. 'Z'. /* the set of all upper case letters */
eol = '\r'. /* the end-of-line character */
noDigit = ANY - digit. /* any character that is not a digit */

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics