|
|
@ -3,6 +3,7 @@ package parser; |
|
|
|
|
|
|
|
|
import java.io.*; |
|
|
import java.io.*; |
|
|
import java.util.Vector; |
|
|
import java.util.Vector; |
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.Stack; |
|
|
import java.util.Stack; |
|
|
|
|
|
|
|
|
import prism.PrismException; |
|
|
import prism.PrismException; |
|
|
@ -19,6 +20,8 @@ public class PrismParser implements PrismParserConstants { |
|
|
private static Stack reverseStack = new Stack(); |
|
|
private static Stack reverseStack = new Stack(); |
|
|
// temp store for modules file associated with properties file |
|
|
// temp store for modules file associated with properties file |
|
|
private static ModulesFile modulesFile; |
|
|
private static ModulesFile modulesFile; |
|
|
|
|
|
// list of keyword strings |
|
|
|
|
|
private static ArrayList keywordList = new ArrayList(); |
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------- |
|
|
//----------------------------------------------------------------------------------- |
|
|
// main method for testing purposes |
|
|
// main method for testing purposes |
|
|
@ -120,7 +123,13 @@ public class PrismParser implements PrismParserConstants { |
|
|
|
|
|
|
|
|
public PrismParser() |
|
|
public PrismParser() |
|
|
{ |
|
|
{ |
|
|
|
|
|
// Call default constructor |
|
|
this(System.in); |
|
|
this(System.in); |
|
|
|
|
|
// Build a list of strings for keywords |
|
|
|
|
|
keywordList.clear(); |
|
|
|
|
|
for (int i = PrismParserConstants.COMMENT+1; i < PrismParserConstants.NOT; i++) { |
|
|
|
|
|
keywordList.add(PrismParserConstants.tokenImage[i].replaceAll("\"", "")); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// parse modules file |
|
|
// parse modules file |
|
|
@ -295,6 +304,13 @@ public class PrismParser implements PrismParserConstants { |
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Test a string to see if it is a PRISM language keyword |
|
|
|
|
|
|
|
|
|
|
|
public static boolean isKeyword(String s) |
|
|
|
|
|
{ |
|
|
|
|
|
return keywordList.contains(s); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------- |
|
|
//----------------------------------------------------------------------------------- |
|
|
// top-level stuff |
|
|
// top-level stuff |
|
|
//----------------------------------------------------------------------------------- |
|
|
//----------------------------------------------------------------------------------- |
|
|
@ -3913,71 +3929,6 @@ public class PrismParser implements PrismParserConstants { |
|
|
finally { jj_save(184, xla); } |
|
|
finally { jj_save(184, xla); } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static final private boolean jj_3R_72() { |
|
|
|
|
|
if (jj_3R_92()) return true; |
|
|
|
|
|
Token xsp; |
|
|
|
|
|
xsp = jj_scanpos; |
|
|
|
|
|
if (jj_3_142()) jj_scanpos = xsp; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3_166() { |
|
|
|
|
|
if (jj_scan_token(FLOOR)) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3R_58() { |
|
|
|
|
|
if (jj_3R_61()) return true; |
|
|
|
|
|
if (jj_scan_token(UNTIL)) return true; |
|
|
|
|
|
if (jj_3R_61()) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3_91() { |
|
|
|
|
|
if (jj_3R_60()) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3_141() { |
|
|
|
|
|
if (jj_3R_72()) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3_69() { |
|
|
|
|
|
if (jj_scan_token(DIVIDE)) return true; |
|
|
|
|
|
if (jj_scan_token(LBRACE)) return true; |
|
|
|
|
|
if (jj_3R_48()) return true; |
|
|
|
|
|
Token xsp; |
|
|
|
|
|
while (true) { |
|
|
|
|
|
xsp = jj_scanpos; |
|
|
|
|
|
if (jj_3_67()) { jj_scanpos = xsp; break; } |
|
|
|
|
|
} |
|
|
|
|
|
if (jj_scan_token(RBRACE)) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3R_84() { |
|
|
|
|
|
if (jj_scan_token(LPARENTH)) return true; |
|
|
|
|
|
if (jj_3R_35()) return true; |
|
|
|
|
|
if (jj_scan_token(RPARENTH)) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3R_47() { |
|
|
|
|
|
if (jj_3R_88()) return true; |
|
|
|
|
|
Token xsp; |
|
|
|
|
|
while (true) { |
|
|
|
|
|
xsp = jj_scanpos; |
|
|
|
|
|
if (jj_3_66()) { jj_scanpos = xsp; break; } |
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3_33() { |
|
|
|
|
|
if (jj_3R_37()) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3_98() { |
|
|
static final private boolean jj_3_98() { |
|
|
if (jj_scan_token(LE)) return true; |
|
|
if (jj_scan_token(LE)) return true; |
|
|
if (jj_3R_35()) return true; |
|
|
if (jj_3R_35()) return true; |
|
|
@ -5935,6 +5886,71 @@ public class PrismParser implements PrismParserConstants { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3R_72() { |
|
|
|
|
|
if (jj_3R_92()) return true; |
|
|
|
|
|
Token xsp; |
|
|
|
|
|
xsp = jj_scanpos; |
|
|
|
|
|
if (jj_3_142()) jj_scanpos = xsp; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3_166() { |
|
|
|
|
|
if (jj_scan_token(FLOOR)) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3R_58() { |
|
|
|
|
|
if (jj_3R_61()) return true; |
|
|
|
|
|
if (jj_scan_token(UNTIL)) return true; |
|
|
|
|
|
if (jj_3R_61()) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3_91() { |
|
|
|
|
|
if (jj_3R_60()) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3_141() { |
|
|
|
|
|
if (jj_3R_72()) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3_69() { |
|
|
|
|
|
if (jj_scan_token(DIVIDE)) return true; |
|
|
|
|
|
if (jj_scan_token(LBRACE)) return true; |
|
|
|
|
|
if (jj_3R_48()) return true; |
|
|
|
|
|
Token xsp; |
|
|
|
|
|
while (true) { |
|
|
|
|
|
xsp = jj_scanpos; |
|
|
|
|
|
if (jj_3_67()) { jj_scanpos = xsp; break; } |
|
|
|
|
|
} |
|
|
|
|
|
if (jj_scan_token(RBRACE)) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3R_84() { |
|
|
|
|
|
if (jj_scan_token(LPARENTH)) return true; |
|
|
|
|
|
if (jj_3R_35()) return true; |
|
|
|
|
|
if (jj_scan_token(RPARENTH)) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3R_47() { |
|
|
|
|
|
if (jj_3R_88()) return true; |
|
|
|
|
|
Token xsp; |
|
|
|
|
|
while (true) { |
|
|
|
|
|
xsp = jj_scanpos; |
|
|
|
|
|
if (jj_3_66()) { jj_scanpos = xsp; break; } |
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final private boolean jj_3_33() { |
|
|
|
|
|
if (jj_3R_37()) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
static private boolean jj_initialized_once = false; |
|
|
static private boolean jj_initialized_once = false; |
|
|
static public PrismParserTokenManager token_source; |
|
|
static public PrismParserTokenManager token_source; |
|
|
static SimpleCharStream jj_input_stream; |
|
|
static SimpleCharStream jj_input_stream; |
|
|
|