public class Lexer extends Object
| Modifier and Type | Field and Description |
|---|---|
static ArrayList<String> |
andOr |
static ArrayList<String> |
binaryRel |
static String |
Clause |
static String |
CloseBracket |
static String |
ClosePar |
static String |
Comma |
static String |
Directive |
static String |
EOFToken |
String |
filename |
static String |
FullStop |
static String |
Ident |
static String |
Implies |
LineNumberReader |
input |
String |
line |
String |
literal |
static String |
Negation |
static String |
Newline |
static String |
NoToken |
static String |
Number |
static String |
OpenBracket |
static String |
OpenPar |
static String |
OptImplies |
static String |
Or |
static String |
Plus |
int |
pos |
static ArrayList<String> |
quant |
static String |
QuotedString |
static String |
SemiComment |
static String |
Stop |
String |
SZS |
static LinkedHashMap<String,Pattern> |
tokenDefs
This array contains all of the compiled Pattern objects that
will be used by methods in this file.
|
ArrayDeque<String> |
tokenStack |
String |
type |
static String |
Var |
static String |
WhiteSpace |
static String |
Zero |
| Constructor and Description |
|---|
Lexer() |
Lexer(File f)
Read a text file into the "input" String variables.
|
Lexer(String s) |
| Modifier and Type | Method and Description |
|---|---|
String |
acceptLit(ArrayList<String> litvals)
Take a list of expected literal strings.
|
String |
acceptLit(String litval)
Take a list of expected literal strings.
|
String |
acceptTok(ArrayList<String> tokens)
Take a list of expected token types.
|
String |
acceptTok(String token)
Take an expected token type.
|
void |
checkTok(ArrayList<String> tokens)
Take a list of expected token types.
|
void |
checkTok(String tok)
Take a list of expected token types.
|
String |
file2string(File f)
Read the contents of a text file into a String.
|
ArrayList<String> |
lex()
Return a list of all tokens in the source.
|
ArrayList<String> |
lexTypes()
Return a list of all tokens in the source.
|
int |
linepos() |
String |
look() |
String |
lookLit() |
String |
lookType() |
static void |
main(String[] args) |
String |
next() |
String |
nextUnfiltered() |
boolean |
testLit(ArrayList<String> litvals) |
boolean |
testLit(String litval) |
boolean |
testTok(ArrayList<String> tokens)
Take a list of expected token types.
|
boolean |
testTok(String tok)
Convenience method
|
public static final String NoToken
public static final String WhiteSpace
public static final String Newline
public static final String SemiComment
public static final String Directive
public static final String Ident
public static final String Number
public static final String QuotedString
public static final String FullStop
public static final String OpenPar
public static final String ClosePar
public static final String OpenBracket
public static final String CloseBracket
public static final String Or
public static final String Plus
public static final String Comma
public static final String Implies
public static final String OptImplies
public static final String Clause
public static final String Var
public static final String Negation
public static final String Stop
public static final String Zero
public static final String EOFToken
public String filename
public String type
public String literal
public String line
public String SZS
public int pos
public LineNumberReader input
public ArrayDeque<String> tokenStack
public static LinkedHashMap<String,Pattern> tokenDefs
public Lexer()
public Lexer(String s)
public Lexer(File f)
public String file2string(File f)
public int linepos()
public String lookType() throws ParseException
ParseExceptionpublic String look() throws ParseException
ParseExceptionpublic String lookLit() throws ParseException
ParseExceptionpublic boolean testTok(ArrayList<String> tokens) throws ParseException
ParseExceptionpublic boolean testTok(String tok) throws ParseException
ParseExceptionpublic void checkTok(String tok) throws ParseException
ParseExceptionpublic void checkTok(ArrayList<String> tokens) throws ParseException
ParseExceptionpublic String acceptTok(String token) throws ParseException
ParseExceptionpublic String acceptTok(ArrayList<String> tokens) throws ParseException
ParseExceptionpublic boolean testLit(String litval) throws ParseException
litval - an expected literal string.ParseExceptionpublic boolean testLit(ArrayList<String> litvals) throws ParseException
litvals - a list of expected literal stringsParseExceptionpublic String acceptLit(ArrayList<String> litvals) throws ParseException
ParseExceptionpublic String acceptLit(String litval) throws ParseException
ParseExceptionpublic String next() throws ParseException
ParseExceptionpublic String nextUnfiltered() throws ParseException
ParseExceptionpublic ArrayList<String> lex() throws ParseException
ParseExceptionpublic ArrayList<String> lexTypes() throws ParseException
ParseExceptionpublic static void main(String[] args)
Copyright © 2015. All rights reserved.