Lexicon.java
|
// FILE. . . . . /home/hak/ilt/src/ilog/rif/Lexicon.java // EDIT BY . . . Hassan Ait-Kaci // ON MACHINE. . 4j4zn71 // STARTED ON. . Thu Apr 03 13:44:34 2008 package ilog.rif.bld;
This is a simple lexicon class implementing a very basic token
discriminator for the tokenizer in Tokenizer.java.
|
import java.util.HashMap; import java.util.HashSet; class Lexicon {
Returns true iff the specified string starts with a question mark, and every other character is a word character. |
public final static boolean isVariable (String s) { char c = s.charAt(0); if (c != '?') return false; for (int i=1; i<s.length(); i++) { c = s.charAt(i); if (!Character.isLetterOrDigit(c) && c != '_') return false; } return true; }
The following is a store for BLD reserved words. |
public static final HashSet reserved = new HashSet();
Returns true iff the specified string is a reserved RCL word. |
public final static boolean isReserved (String word) { return reserved.contains(word); }
Declares the specified string as a reserved word. |
static final void reserved (String word) { reserved.add(word); } }
This file was generated on Thu Feb 17 16:55:59 PST 2011 from file Lexicon.java
by the ilog.language.tools.Hilite Java tool written by Hassan Aït-Kaci