common_token.sa
Upload User: afrynkmhm
Upload Date: 2007-01-06
Package Size: 1262k
Code Size: 1k
Development Platform:

Others

  1. (* 
  2.   ANTLR Translator Generator
  3.   Project led by Terence Parr at http://www.jGuru.com
  4.   Software rights: http://www.antlr.org/RIGHTS.html
  5.  
  6.   $Id: //depot/code/org.antlr/release/antlr-2.7.0/lib/sather/Antlr/common_token.sa#1 $
  7. *)
  8. class ANTLR_COMMON_TOKEN < $ANTLR_TOKEN is
  9.    -- constants
  10.    const MIN_USER_TYPE       : INT :=  4;
  11.    const NULL_TREE_LOOKAHEAD : INT :=  3;
  12.    const INVALID_TYPE        : INT :=  0;
  13.    const EOF_TYPE            : INT :=  1;
  14.    const SKIP                : INT := -1;
  15.    attr column : INT;
  16.    attr line   : INT;
  17.    attr ttype  : INT;
  18.    attr text   : STR;
  19.    create : SAME is
  20.       res : SAME := new;
  21.       res.ttype := INVALID_TYPE;
  22.       return res;
  23.    end;
  24.    create( t: INT ) : SAME is
  25.       res : SAME := new;
  26.       res.ttype := t;
  27.       return res;
  28.    end;
  29.    create( t: INT , txt : STR ) : SAME is
  30.       res : SAME := new;
  31.       res.ttype := t;
  32.       res.text := txt;
  33.       return res;
  34.    end;
  35.    str: STR is
  36.       return "["" + text + "",<" + ttype + ">,line=" + line + "]";
  37.    end;
  38.    invalid : BOOL is
  39.       return ( ttype = INVALID_TYPE );
  40.    end;
  41. end;