⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 re2c.man

📁 支持AMD64的汇编编译器源码
💻 MAN
📖 第 1 页 / 共 2 页
字号:
RE2C(1)                                                   RE2C(1)                      s->tok = s->bot;                      s->ptr -= cnt;                      cursor -= cnt;                      s->pos -= cnt;                      s->lim -= cnt;                  }                  if((s->top - s->lim) < BSIZE){                      uchar *buf = (uchar*)                          malloc(((s->lim - s->bot) + BSIZE)*sizeof(uchar));                      memcpy(buf, s->tok, s->lim - s->tok);                      s->tok = buf;                      s->ptr = &buf[s->ptr - s->bot];                      cursor = &buf[cursor - s->bot];                      s->pos = &buf[s->pos - s->bot];                      s->lim = &buf[s->lim - s->bot];                      s->top = &s->lim[BSIZE];                      free(s->bot);                      s->bot = buf;                  }                  if((cnt = read(s->fd, (char*) s->lim, BSIZE)) != BSIZE){                      s->eof = &s->lim[cnt]; *(s->eof)++ = '\n';                  }                  s->lim += cnt;              }              return cursor;          }          int scan(Scanner *s){                  uchar *cursor = s->cur;          std:                  s->tok = cursor;          /*!re2c          any     = [\000-\377];          O       = [0-7];          D       = [0-9];          L       = [a-zA-Z_];          H       = [a-fA-F0-9];          E       = [Ee] [+-]? D+;          FS      = [fFlL];          IS      = [uUlL]*;          ESC     = [\\] ([abfnrtv?'"\\] | "x" H+ | O+);          */          /*!re2c                  "/*"                    { goto comment; }                  "auto"                  { RET(AUTO); }                  "break"                 { RET(BREAK); }                  "case"                  { RET(CASE); }                  "char"                  { RET(CHAR); }                  "const"                 { RET(CONST); }                  "continue"              { RET(CONTINUE); }                  "default"               { RET(DEFAULT); }                  "do"                    { RET(DO); }Version 0.5                8 April 1994                         6RE2C(1)                                                   RE2C(1)                  "double"                { RET(DOUBLE); }                  "else"                  { RET(ELSE); }                  "enum"                  { RET(ENUM); }                  "extern"                { RET(EXTERN); }                  "float"                 { RET(FLOAT); }                  "for"                   { RET(FOR); }                  "goto"                  { RET(GOTO); }                  "if"                    { RET(IF); }                  "int"                   { RET(INT); }                  "long"                  { RET(LONG); }                  "register"              { RET(REGISTER); }                  "return"                { RET(RETURN); }                  "short"                 { RET(SHORT); }                  "signed"                { RET(SIGNED); }                  "sizeof"                { RET(SIZEOF); }                  "static"                { RET(STATIC); }                  "struct"                { RET(STRUCT); }                  "switch"                { RET(SWITCH); }                  "typedef"               { RET(TYPEDEF); }                  "union"                 { RET(UNION); }                  "unsigned"              { RET(UNSIGNED); }                  "void"                  { RET(VOID); }                  "volatile"              { RET(VOLATILE); }                  "while"                 { RET(WHILE); }                  L (L|D)*                { RET(ID); }                  ("0" [xX] H+ IS?) | ("0" D+ IS?) | (D+ IS?) |                  (['] (ESC|any\[\n\\'])* ['])                                          { RET(ICON); }                  (D+ E FS?) | (D* "." D+ E? FS?) | (D+ "." D* E? FS?)                                          { RET(FCON); }                  (["] (ESC|any\[\n\\"])* ["])                                          { RET(SCON); }                  "..."                   { RET(ELLIPSIS); }                  ">>="                   { RET(RSHIFTEQ); }                  "<<="                   { RET(LSHIFTEQ); }                  "+="                    { RET(ADDEQ); }                  "-="                    { RET(SUBEQ); }                  "*="                    { RET(MULEQ); }                  "/="                    { RET(DIVEQ); }                  "%="                    { RET(MODEQ); }                  "&="                    { RET(ANDEQ); }                  "^="                    { RET(XOREQ); }                  "|="                    { RET(OREQ); }                  ">>"                    { RET(RSHIFT); }                  "<<"                    { RET(LSHIFT); }                  "++"                    { RET(INCR); }                  "--"                    { RET(DECR); }                  "->"                    { RET(DEREF); }                  "&&"                    { RET(ANDAND); }Version 0.5                8 April 1994                         7RE2C(1)                                                   RE2C(1)                  "||"                    { RET(OROR); }                  "<="                    { RET(LEQ); }                  ">="                    { RET(GEQ); }                  "=="                    { RET(EQL); }                  "!="                    { RET(NEQ); }                  ";"                     { RET(';'); }                  "{"                     { RET('{'); }                  "}"                     { RET('}'); }                  ","                     { RET(','); }                  ":"                     { RET(':'); }                  "="                     { RET('='); }                  "("                     { RET('('); }                  ")"                     { RET(')'); }                  "["                     { RET('['); }                  "]"                     { RET(']'); }                  "."                     { RET('.'); }                  "&"                     { RET('&'); }                  "!"                     { RET('!'); }                  "~"                     { RET('~'); }                  "-"                     { RET('-'); }                  "+"                     { RET('+'); }                  "*"                     { RET('*'); }                  "/"                     { RET('/'); }                  "%"                     { RET('%'); }                  "<"                     { RET('<'); }                  ">"                     { RET('>'); }                  "^"                     { RET('^'); }                  "|"                     { RET('|'); }                  "?"                     { RET('?'); }                  [ \t\v\f]+           { goto std; }                  "\n"                      {                          if(cursor == s->eof) RET(EOI);                          s->pos = cursor; s->line++;                          goto std;                      }                  any                      {                          printf("unexpected character: %c\n", *s->tok);                          goto std;                      }          */          comment:          /*!re2c                  "*/"                    { goto std; }                  "\n"                      {                          if(cursor == s->eof) RET(EOI);                          s->tok = s->pos = cursor; s->line++;Version 0.5                8 April 1994                         8RE2C(1)                                                   RE2C(1)                          goto comment;                      }                  any                     { goto comment; }          */          }          main(){              Scanner in;              int t;              memset((char*) &in, 0, sizeof(in));              in.fd = 0;              while((t = scan(&in)) != EOI){          /*                  printf("%d\t%.*s\n", t, in.cur - in.tok, in.tok);                  printf("%d\n", t);          */              }              close(in.fd);          }SSEEEE AALLSSOO       flex(1), lex(1).FFEEAATTUURREESS       rree22cc does not provide a default action: the generated code       assumes  that  the  input  will  consist  of a sequence of       tokens.  Typically this can be dealt with by adding a rule       such  as  the one for unexpected characters in the example       above.       The user must arrange for a sentinel token  to  appear  at       the  end  of  input  (and provide a rule for matching it):       rree22cc does not  provide  an  <<<<EEOOFF>>>>  expression.   If  the       source  is  from  a  null-byte  terminated  string, a rule       matching a null character will suffice.  If the source  is       from  a file then the approach taken in the example can be       used: pad the input with a newline (or some other  charac-       ter  that  can't appear within another token); upon recog-       nizing such a character check to see if it is the sentinel       and act accordingly.       rree22cc  does  not  provide start conditions:  use a separate       scanner specification for each start condition (as  illus-       trated in the above example).       No [^x].  Use difference instead.BBUUGGSS       Only fixed length trailing context can be handled.       The  maximum value appearing as a parameter _n to YYYYFFIILLLL is       not provided to the generated code (this value  is  neededVersion 0.5                8 April 1994                         9RE2C(1)                                                   RE2C(1)       for  constructing  the  interface  code).   Note that this       value is usually relatively small: for typical programming       languages _n will be the length of the longest keyword plus       one.       Difference only works for character sets.       The rree22cc internal algorithms need documentation.AAUUTTHHOORR       Please send bug reports, fixes and feedback to:       Peter Bumbulis       Computer Systems Group       University of Waterloo       Waterloo, Ontario       N2L 3G1       Internet:  peterr@csg.uwaterloo.caVersion 0.5                8 April 1994                        10

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -