Browse Source

Réparation des erreurs de git

J'ai réparé les erreurs causées par git lors d'un passage à une version antérieure du projet
dev
Guillaume 3 years ago
parent
commit
d878335013
  1. 3
      .settings/org.eclipse.core.resources.prefs
  2. 1
      bin/.gitignore
  3. BIN
      bin/dao/CEquipment.class
  4. BIN
      bin/main/CMain.class
  5. BIN
      bin/net/CServer.class
  6. 6
      lib/Parser/MonProgrammeDomotique.ldsd
  7. 17
      lib/Parser/readme.txt
  8. 2
      lib/Parser/run.bat
  9. BIN
      lib/Parser/scenarios/parser/CParserDSDL.class
  10. 295
      lib/Parser/scenarios/parser/CParserDSDL.java
  11. BIN
      lib/Parser/scenarios/parser/CParserDSDLConstants.class
  12. 131
      lib/Parser/scenarios/parser/CParserDSDLConstants.java
  13. BIN
      lib/Parser/scenarios/parser/CParserDSDLTokenManager.class
  14. 1409
      lib/Parser/scenarios/parser/CParserDSDLTokenManager.java
  15. 154
      lib/Parser/scenarios/parser/FinalVersionParserDSDL.jj
  16. BIN
      lib/Parser/scenarios/parser/ParseException.class
  17. 187
      lib/Parser/scenarios/parser/ParseException.java
  18. BIN
      lib/Parser/scenarios/parser/SimpleCharStream.class
  19. 471
      lib/Parser/scenarios/parser/SimpleCharStream.java
  20. BIN
      lib/Parser/scenarios/parser/Token.class
  21. 131
      lib/Parser/scenarios/parser/Token.java
  22. BIN
      lib/Parser/scenarios/parser/TokenMgrError.class
  23. 147
      lib/Parser/scenarios/parser/TokenMgrError.java
  24. 4
      lib/Parser/scenarios/parser/clean.bat
  25. 4
      lib/Parser/scenarios/parser/genererApplication.bat
  26. 4
      lib/Parser/scenarios/parser/genererParseur.bat
  27. 27
      lib/Parser/scenarios/parser/javacc-5.0/LICENSE
  28. 9
      lib/Parser/scenarios/parser/javacc-5.0/bin/javacc
  29. 4
      lib/Parser/scenarios/parser/javacc-5.0/bin/javacc.bat
  30. 9
      lib/Parser/scenarios/parser/javacc-5.0/bin/jjdoc
  31. 4
      lib/Parser/scenarios/parser/javacc-5.0/bin/jjdoc.bat
  32. 179
      lib/Parser/scenarios/parser/javacc-5.0/bin/jjrun
  33. 9
      lib/Parser/scenarios/parser/javacc-5.0/bin/jjtree
  34. 4
      lib/Parser/scenarios/parser/javacc-5.0/bin/jjtree.bat
  35. BIN
      lib/Parser/scenarios/parser/javacc-5.0/bin/lib/javacc.jar
  36. 285
      lib/Parser/scenarios/parser/javacc-5.0/doc/CharStream.html
  37. 121
      lib/Parser/scenarios/parser/javacc-5.0/doc/JJDoc.html
  38. 620
      lib/Parser/scenarios/parser/javacc-5.0/doc/JJTree.html
  39. 1635
      lib/Parser/scenarios/parser/javacc-5.0/doc/JavaCC.html
  40. 458
      lib/Parser/scenarios/parser/javacc-5.0/doc/JavaCC.txt
  41. 552
      lib/Parser/scenarios/parser/javacc-5.0/doc/apiroutines.html
  42. 124
      lib/Parser/scenarios/parser/javacc-5.0/doc/commandline.html
  43. 114
      lib/Parser/scenarios/parser/javacc-5.0/doc/docindex.html
  44. 311
      lib/Parser/scenarios/parser/javacc-5.0/doc/errorrecovery.html
  45. 158
      lib/Parser/scenarios/parser/javacc-5.0/doc/features.html
  46. 128
      lib/Parser/scenarios/parser/javacc-5.0/doc/index.html
  47. 91
      lib/Parser/scenarios/parser/javacc-5.0/doc/installhelp.html
  48. 1485
      lib/Parser/scenarios/parser/javacc-5.0/doc/javaccgrm.html
  49. 754
      lib/Parser/scenarios/parser/javacc-5.0/doc/javaccreleasenotes.html
  50. 148
      lib/Parser/scenarios/parser/javacc-5.0/doc/jjdocreleasenotes.html
  51. 207
      lib/Parser/scenarios/parser/javacc-5.0/doc/jjtreeREADME.html
  52. 501
      lib/Parser/scenarios/parser/javacc-5.0/doc/jjtreeintro.html
  53. 472
      lib/Parser/scenarios/parser/javacc-5.0/doc/jjtreereleasenotes.html
  54. 130
      lib/Parser/scenarios/parser/javacc-5.0/doc/lexertips.html
  55. 986
      lib/Parser/scenarios/parser/javacc-5.0/doc/lookahead.html
  56. 53
      lib/Parser/scenarios/parser/javacc-5.0/doc/mailinglist.html
  57. 482
      lib/Parser/scenarios/parser/javacc-5.0/doc/simpleREADME.html
  58. 45
      lib/Parser/scenarios/parser/javacc-5.0/doc/support.html
  59. 377
      lib/Parser/scenarios/parser/javacc-5.0/doc/tokenmanager.html
  60. 7
      lib/Parser/scenarios/parser/javacc-5.0/examples/CORBA-IDL/Hello.idl
  61. 865
      lib/Parser/scenarios/parser/javacc-5.0/examples/CORBA-IDL/IDL.jj
  62. 34
      lib/Parser/scenarios/parser/javacc-5.0/examples/CORBA-IDL/README
  63. 237
      lib/Parser/scenarios/parser/javacc-5.0/examples/GUIParsing/ParserVersion/CalcGUI.java
  64. 140
      lib/Parser/scenarios/parser/javacc-5.0/examples/GUIParsing/ParserVersion/CalcInput.jj
  65. 45
      lib/Parser/scenarios/parser/javacc-5.0/examples/GUIParsing/ParserVersion/Main.java
  66. 69
      lib/Parser/scenarios/parser/javacc-5.0/examples/GUIParsing/ParserVersion/ProducerConsumer.java
  67. 51
      lib/Parser/scenarios/parser/javacc-5.0/examples/GUIParsing/ParserVersion/README
  68. 36
      lib/Parser/scenarios/parser/javacc-5.0/examples/GUIParsing/ParserVersion/TokenCollector.java
  69. 41
      lib/Parser/scenarios/parser/javacc-5.0/examples/GUIParsing/README
  70. 254
      lib/Parser/scenarios/parser/javacc-5.0/examples/GUIParsing/TokenMgrVersion/CalcGUI.java
  71. 220
      lib/Parser/scenarios/parser/javacc-5.0/examples/GUIParsing/TokenMgrVersion/CalcInput.jj
  72. 223
      lib/Parser/scenarios/parser/javacc-5.0/examples/GUIParsing/TokenMgrVersion/CharCollector.java
  73. 43
      lib/Parser/scenarios/parser/javacc-5.0/examples/GUIParsing/TokenMgrVersion/Main.java
  74. 52
      lib/Parser/scenarios/parser/javacc-5.0/examples/GUIParsing/TokenMgrVersion/MyLexer.java
  75. 63
      lib/Parser/scenarios/parser/javacc-5.0/examples/GUIParsing/TokenMgrVersion/README
  76. 48
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTAddNode.java
  77. 55
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTAndNode.java
  78. 47
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTAssignment.java
  79. 53
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTBitwiseAndNode.java
  80. 46
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTBitwiseComplNode.java
  81. 52
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTBitwiseOrNode.java
  82. 52
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTBitwiseXorNode.java
  83. 49
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTBlock.java
  84. 63
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTCompilationUnit.java
  85. 49
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTDivNode.java
  86. 53
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTEQNode.java
  87. 45
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTFalseNode.java
  88. 49
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTGENode.java
  89. 52
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTGTNode.java
  90. 48
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTId.java
  91. 50
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTIfStatement.java
  92. 48
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTIntConstNode.java
  93. 49
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTLENode.java
  94. 49
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTLTNode.java
  95. 49
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTModNode.java
  96. 49
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTMulNode.java
  97. 54
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTNENode.java
  98. 47
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTNotNode.java
  99. 55
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTOrNode.java
  100. 68
      lib/Parser/scenarios/parser/javacc-5.0/examples/Interpreter/ASTReadStatement.java

3
.settings/org.eclipse.core.resources.prefs

@ -0,0 +1,3 @@
eclipse.preferences.version=1
encoding//src/dao/CEquipment.java=UTF-8
encoding//src/net/CCommandManager.java=UTF-8

1
bin/.gitignore

@ -1,4 +1,3 @@
/scenarios/
/actions/
/dao/
/main/

BIN
bin/dao/CEquipment.class

Binary file not shown.

BIN
bin/main/CMain.class

Binary file not shown.

BIN
bin/net/CServer.class

Binary file not shown.

6
lib/Parser/MonProgrammeDomotique.ldsd

@ -1,6 +0,0 @@
allumer lumiere1 de (chambre2;rdc) pendant 10 secondes
eteindre lumiere1 de (chambre2;rdc)
allumer lumiere2 de (chambre2;rdc) pendant 10 secondes
allumer lumiere3 de (chambre3;rdc)
allumer lumiere4 de (salon;premier_etage) pendant 10 secondes
allumer lumiere5 de (chambre2;rdc) pendant 10 secondes

17
lib/Parser/readme.txt

@ -1,17 +0,0 @@
Ce répertoire contient :
- le fichier jj permettant de spécifier l'analyseur lexical et l'analyseur syntaxique
du langage domotique (repertoire scenarios\parser)
- un exemple de programme domotique (fichier *.ldsd)
Compilation du parseur :
1) Se placer dans le répertoire scenarios\parser.
2) Lancer le fichier batch genererParseur.
Ceci génère l'ensemble du code Java (via javacc) du parseur.
3) Lancer le fichier batch genererApplication.
Ceci compile l'application avec le parseur (via javac).
Exécution du parseur et interprétation du fichier domotique :
Lancer le fichier batch run

2
lib/Parser/run.bat

@ -1,2 +0,0 @@
@echo off
java scenarios.parser.CParserDSDL MonProgrammeDomotique.ldsd

BIN
lib/Parser/scenarios/parser/CParserDSDL.class

Binary file not shown.

295
lib/Parser/scenarios/parser/CParserDSDL.java

@ -1,295 +0,0 @@
/* Generated By:JavaCC: Do not edit this line. CParserDSDL.java */
package scenarios.parser;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.List;
import java.util.ArrayList;
public class CParserDSDL implements CParserDSDLConstants {
public static void main(String[] args)
throws TokenMgrError, FileNotFoundException {
CParserDSDL lParser = new CParserDSDL(
new FileInputStream(args[0]));
try {
lParser.Start() ;
} catch (ParseException lException) {
System.out.println("Erreur de parsing : " + lException.getMessage());
}
// TODO : ici doit se trouver la demande d'exécution du scénario.
}
final public void Start() throws ParseException {
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMENTARY:
case EOL:
case SWITCH_ON:
;
break;
default:
jj_la1[0] = jj_gen;
break label_1;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SWITCH_ON:
Instruction();
System.out.println("Instruction lue !");
break;
case EOL:
jj_consume_token(EOL);
break;
case COMMENTARY:
jj_consume_token(COMMENTARY);
break;
default:
jj_la1[1] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
jj_consume_token(0);
}
final public void Instruction() throws ParseException {
SwitchOnAction();
System.out.println("Instruction lue !");
}
final public void SwitchOnAction() throws ParseException {
Token t1 = null;
Token t2 = null;
Token t3 = null;
Token t4 = null;
Token t5 = null;
jj_consume_token(SWITCH_ON);
t1 = jj_consume_token(ID);
jj_consume_token(OF);
jj_consume_token(PAR_OPEN);
t2 = jj_consume_token(ID);
jj_consume_token(SEP);
t3 = jj_consume_token(ID);
jj_consume_token(PAR_CLOSE);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case DURING:
jj_consume_token(DURING);
t4 = jj_consume_token(NUMBER);
t5 = jj_consume_token(UNIT);
break;
default:
jj_la1[2] = jj_gen;
;
}
jj_consume_token(EOL);
if ( (t4 == null) && (t5 == null) ) {
System.out.println("Allumage \u00e9quipement en cours (sans dur\u00e9e) !");
} else {
long duration = ComputeDuration(t4.image, t5.image);
System.out.println("Allumage \u00e9quipement en cours (avec dur\u00e9e) !");
}
}
final public long ComputeDuration(String pDuration, String pUnit) throws ParseException {
long duration = Integer.parseInt(pDuration);
if ("seconds".equals(pUnit)) {
duration *= 1000;
} if ("minute".equals(pUnit)) {
duration *= 60000;
} if ("minutes".equals(pUnit)) {
duration *= 60000;
} else if ("hour".equals(pUnit)) {
duration *= 3600000;
} else if ("hours".equals(pUnit)) {
duration *= 3600000;
} else if ("day".equals(pUnit)) {
duration *= 86400000;
} else if ("days".equals(pUnit)) {
duration *= 86400000;
}
{if (true) return duration;}
throw new Error("Missing return statement in function");
}
/** Generated Token Manager. */
public CParserDSDLTokenManager token_source;
SimpleCharStream jj_input_stream;
/** Current token. */
public Token token;
/** Next token. */
public Token jj_nt;
private int jj_ntk;
private int jj_gen;
final private int[] jj_la1 = new int[3];
static private int[] jj_la1_0;
static private int[] jj_la1_1;
static {
jj_la1_init_0();
jj_la1_init_1();
}
private static void jj_la1_init_0() {
jj_la1_0 = new int[] {0x80000c,0x80000c,0x2000,};
}
private static void jj_la1_init_1() {
jj_la1_1 = new int[] {0x0,0x0,0x0,};
}
/** Constructor with InputStream. */
public CParserDSDL(java.io.InputStream stream) {
this(stream, null);
}
/** Constructor with InputStream and supplied encoding */
public CParserDSDL(java.io.InputStream stream, String encoding) {
try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
token_source = new CParserDSDLTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 3; i++) jj_la1[i] = -1;
}
/** Reinitialise. */
public void ReInit(java.io.InputStream stream) {
ReInit(stream, null);
}
/** Reinitialise. */
public void ReInit(java.io.InputStream stream, String encoding) {
try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
token_source.ReInit(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 3; i++) jj_la1[i] = -1;
}
/** Constructor. */
public CParserDSDL(java.io.Reader stream) {
jj_input_stream = new SimpleCharStream(stream, 1, 1);
token_source = new CParserDSDLTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 3; i++) jj_la1[i] = -1;
}
/** Reinitialise. */
public void ReInit(java.io.Reader stream) {
jj_input_stream.ReInit(stream, 1, 1);
token_source.ReInit(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 3; i++) jj_la1[i] = -1;
}
/** Constructor with generated Token Manager. */
public CParserDSDL(CParserDSDLTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 3; i++) jj_la1[i] = -1;
}
/** Reinitialise. */
public void ReInit(CParserDSDLTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 3; i++) jj_la1[i] = -1;
}
private Token jj_consume_token(int kind) throws ParseException {
Token oldToken;
if ((oldToken = token).next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
if (token.kind == kind) {
jj_gen++;
return token;
}
token = oldToken;
jj_kind = kind;
throw generateParseException();
}
/** Get the next Token. */
final public Token getNextToken() {
if (token.next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
jj_gen++;
return token;
}
/** Get the specific Token. */
final public Token getToken(int index) {
Token t = token;
for (int i = 0; i < index; i++) {
if (t.next != null) t = t.next;
else t = t.next = token_source.getNextToken();
}
return t;
}
private int jj_ntk() {
if ((jj_nt=token.next) == null)
return (jj_ntk = (token.next=token_source.getNextToken()).kind);
else
return (jj_ntk = jj_nt.kind);
}
private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
private int[] jj_expentry;
private int jj_kind = -1;
/** Generate ParseException. */
public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[38];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 3; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if ((jj_la1_0[i] & (1<<j)) != 0) {
la1tokens[j] = true;
}
if ((jj_la1_1[i] & (1<<j)) != 0) {
la1tokens[32+j] = true;
}
}
}
}
for (int i = 0; i < 38; i++) {
if (la1tokens[i]) {
jj_expentry = new int[1];
jj_expentry[0] = i;
jj_expentries.add(jj_expentry);
}
}
int[][] exptokseq = new int[jj_expentries.size()][];
for (int i = 0; i < jj_expentries.size(); i++) {
exptokseq[i] = jj_expentries.get(i);
}
return new ParseException(token, exptokseq, tokenImage);
}
/** Enable tracing. */
final public void enable_tracing() {
}
/** Disable tracing. */
final public void disable_tracing() {
}
}

BIN
lib/Parser/scenarios/parser/CParserDSDLConstants.class

Binary file not shown.

131
lib/Parser/scenarios/parser/CParserDSDLConstants.java

@ -1,131 +0,0 @@
/* Generated By:JavaCC: Do not edit this line. CParserDSDLConstants.java */
package scenarios.parser;
/**
* Token literal values and constants.
* Generated by org.javacc.parser.OtherFilesGen#start()
*/
public interface CParserDSDLConstants {
/** End of File. */
int EOF = 0;
/** RegularExpression Id. */
int COMMENTARY = 2;
/** RegularExpression Id. */
int EOL = 3;
/** RegularExpression Id. */
int ACC_OPEN = 4;
/** RegularExpression Id. */
int ACC_CLOSE = 5;
/** RegularExpression Id. */
int PAR_OPEN = 6;
/** RegularExpression Id. */
int PAR_CLOSE = 7;
/** RegularExpression Id. */
int SEP = 8;
/** RegularExpression Id. */
int ASSOCIATE = 9;
/** RegularExpression Id. */
int AT = 10;
/** RegularExpression Id. */
int DO = 11;
/** RegularExpression Id. */
int DAY = 12;
/** RegularExpression Id. */
int DURING = 13;
/** RegularExpression Id. */
int EACH = 14;
/** RegularExpression Id. */
int ELSE = 15;
/** RegularExpression Id. */
int EVERYDAY = 16;
/** RegularExpression Id. */
int EXCEPT = 17;
/** RegularExpression Id. */
int FOR = 18;
/** RegularExpression Id. */
int IF = 19;
/** RegularExpression Id. */
int OF = 20;
/** RegularExpression Id. */
int ON = 21;
/** RegularExpression Id. */
int SWITCH_OFF = 22;
/** RegularExpression Id. */
int SWITCH_ON = 23;
/** RegularExpression Id. */
int THEN = 24;
/** RegularExpression Id. */
int TO = 25;
/** RegularExpression Id. */
int WAIT = 26;
/** RegularExpression Id. */
int WHEN = 27;
/** RegularExpression Id. */
int DAYS = 28;
/** RegularExpression Id. */
int UNIT = 29;
/** RegularExpression Id. */
int DATE = 30;
/** RegularExpression Id. */
int TIME = 31;
/** RegularExpression Id. */
int U_SECONDS = 32;
/** RegularExpression Id. */
int U_MINUTES = 33;
/** RegularExpression Id. */
int U_HOURS = 34;
/** RegularExpression Id. */
int U_DAYS = 35;
/** RegularExpression Id. */
int ID = 36;
/** RegularExpression Id. */
int NUMBER = 37;
/** Lexical state. */
int DEFAULT = 0;
/** Literal token values. */
String[] tokenImage = {
"<EOF>",
"\" \"",
"<COMMENTARY>",
"<EOL>",
"\"{\"",
"\"}\"",
"\"(\"",
"\")\"",
"\";\"",
"\"associer\"",
"\"a\"",
"\"faire\"",
"\"jour\"",
"\"pendant\"",
"\"chaque\"",
"\"autre\"",
"\"chaque jours\"",
"\"sauf\"",
"\"pour\"",
"\"si\"",
"\"de\"",
"\"sur\"",
"\"eteindre\"",
"\"allumer\"",
"\"puis\"",
"\"vers\"",
"\"attendre\"",
"\"quand\"",
"<DAYS>",
"<UNIT>",
"<DATE>",
"<TIME>",
"<U_SECONDS>",
"<U_MINUTES>",
"<U_HOURS>",
"<U_DAYS>",
"<ID>",
"<NUMBER>",
};
}

BIN
lib/Parser/scenarios/parser/CParserDSDLTokenManager.class

Binary file not shown.

1409
lib/Parser/scenarios/parser/CParserDSDLTokenManager.java

File diff suppressed because it is too large

154
lib/Parser/scenarios/parser/FinalVersionParserDSDL.jj

@ -1,154 +0,0 @@
options {
STATIC = false ;
}
PARSER_BEGIN(CParserDSDL)
package scenarios.parser;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.List;
import java.util.ArrayList;
import actions.CScenarioManager;
public class CParserDSDL {
public static void main(String[] args)
throws TokenMgrError, FileNotFoundException {
CParserDSDL lParser = new CParserDSDL(
new FileInputStream(args[0]));
try {
lParser.Start() ;
} catch (ParseException lException) {
System.out.println("Erreur de parsing : " + lException.getMessage());
}
// TODO : ici doit se trouver la demande d'exécution du scénario.
}
}
PARSER_END(CParserDSDL)
SKIP : { " " }
TOKEN : { <COMMENTARY : "#"(["a"-"z"]|["A"-"Z"]|["0"-"9"]|"*"|"_"|" "|":"|"-"|"'")*> }
TOKEN : { <EOL : "\n" | "\r" | "\r\n"> }
TOKEN : { <ACC_OPEN : "{"> }
TOKEN : { <ACC_CLOSE : "}"> }
TOKEN : { <PAR_OPEN : "("> }
TOKEN : { <PAR_CLOSE : ")"> }
TOKEN : { <SEP : ";"> }
TOKEN : { <ASSOCIATE : "associer"> }
TOKEN : { <AT : "a"> }
TOKEN : { <DO : "faire"> }
TOKEN : { <DAY : "jour"> }
TOKEN : { <DURING : "pendant"> }
TOKEN : { <EACH : "chaque"> }
TOKEN : { <ELSE : "autre"> }
TOKEN : { <EVERYDAY : "chaque jours"> }
TOKEN : { <EXCEPT : "sauf"> }
TOKEN : { <FOR : "pour"> }
TOKEN : { <IF : "si"> }
TOKEN : { <OF : "de"> }
TOKEN : { <ON : "sur"> }
TOKEN : { <SWITCH_OFF : "eteindre"> }
TOKEN : { <SWITCH_ON : "allumer"> }
TOKEN : { <THEN : "puis"> }
TOKEN : { <TO : "vers"> }
TOKEN : { <WAIT : "attendre"> }
TOKEN : { <WHEN : "quand"> }
TOKEN : { <DAYS : "dimanche" | "lundi" | "mardi" | "mercredi" | "jeudi" | "vendredi" | "samedi"> }
TOKEN : { <UNIT : <U_SECONDS> | <U_MINUTES> | <U_HOURS> | <U_DAYS> > }
TOKEN : { <DATE : ["0"-"9"]["0"-"9"]"/"["0"-"9"]["0"-"9"]"/"["0"-"9"]["0"-"9"]> }
TOKEN : { <TIME : (["0"-"9"])?["0"-"9"]":"["0"-"9"]["0"-"9"]":"["0"-"9"]["0"-"9"]> }
TOKEN : { <#U_SECONDS : "seconde" | "secondes"> }
TOKEN : { <#U_MINUTES : "minute" | "minutes"> }
TOKEN : { <#U_HOURS : "heure" | "heures"> }
TOKEN : { <#U_DAYS : "jour" | "jours"> }
TOKEN : { <ID : (["a"-"z"]|["A"-"Z"]|"_")(["a"-"z"]|["A"-"Z"]|["0"-"9"]|"_"|"-"|"/"|"'"|<NUMBER>)+> }
TOKEN : { <NUMBER : (["0"-"9"])+ > }
void Start() :
{
}
{
(
Instruction()
{ System.out.println("Instruction lue !"); }
|
<EOL>
|
<COMMENTARY>
)*
<EOF>
}
void Instruction() :
{
}
{
SwitchOnAction()
{ System.out.println("Instruction lue !"); }
}
void SwitchOnAction() :
{
Token t1 = null;
Token t2 = null;
Token t3 = null;
Token t4 = null;
Token t5 = null;
}
{
<SWITCH_ON> t1=<ID> <OF> <PAR_OPEN> t2=<ID> <SEP> t3=<ID> <PAR_CLOSE> (<DURING> t4=<NUMBER> t5=<UNIT>)? <EOL>
{
if ( (t4 == null) && (t5 == null) ) {
System.out.println("Allumage équipement en cours (sans durée) !");
CScenarioManager.getInstance().addAction(new CSwitchOnAction(t1.image, t2.image, t3.image));
} else {
long duration = ComputeDuration(t4.image, t5.image);
System.out.println("Allumage équipement en cours (avec durée) !");
CScenarioManager.getInstance().addAction(new CSwitchOnAction(t1.image, t2.image, t3.image, duration));
}
}
}
{
<SWITCH_OFF> t1=<ID> <OF> <PAR_OPEN> t2=<ID> <SEP> t3=<ID> <PAR_CLOSE> (<DURING> t4=<NUMBER> t5=<UNIT>)? <EOL>
{
if ( (t4 == null) && (t5 == null) ) {
System.out.println("Extinction équipement en cours (sans durée) !");
CScenarioManager.getInstance().addAction(new CSwitchOffAction(t1.image, t2.image, t3.image));
} else {
long duration = ComputeDuration(t4.image, t5.image);
System.out.println("Extenction équipement en cours (avec durée) !");
CScenarioManager.getInstance().addAction(new CSwitchOffAction(t1.image, t2.image, t3.image, duration));
}
}
}
long ComputeDuration(String pDuration, String pUnit) :
{
long duration = Integer.parseInt(pDuration);
}
{
{
if ("seconds".equals(pUnit)) {
duration *= 1000;
} if ("minute".equals(pUnit)) {
duration *= 60000;
} if ("minutes".equals(pUnit)) {
duration *= 60000;
} else if ("hour".equals(pUnit)) {
duration *= 3600000;
} else if ("hours".equals(pUnit)) {
duration *= 3600000;
} else if ("day".equals(pUnit)) {
duration *= 86400000;
} else if ("days".equals(pUnit)) {
duration *= 86400000;
}
return duration;
}
}

BIN
lib/Parser/scenarios/parser/ParseException.class

Binary file not shown.

187
lib/Parser/scenarios/parser/ParseException.java

@ -1,187 +0,0 @@
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */
/* JavaCCOptions:KEEP_LINE_COL=null */
package scenarios.parser;
/**
* This exception is thrown when parse errors are encountered.
* You can explicitly create objects of this exception type by
* calling the method generateParseException in the generated
* parser.
*
* You can modify this class to customize your error reporting
* mechanisms so long as you retain the public fields.
*/
public class ParseException extends Exception {
/**
* The version identifier for this Serializable class.
* Increment only if the <i>serialized</i> form of the
* class changes.
*/
private static final long serialVersionUID = 1L;
/**
* This constructor is used by the method "generateParseException"
* in the generated parser. Calling this constructor generates
* a new object of this type with the fields "currentToken",
* "expectedTokenSequences", and "tokenImage" set.
*/
public ParseException(Token currentTokenVal,
int[][] expectedTokenSequencesVal,
String[] tokenImageVal
)
{
super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));
currentToken = currentTokenVal;
expectedTokenSequences = expectedTokenSequencesVal;
tokenImage = tokenImageVal;
}
/**
* The following constructors are for use by you for whatever
* purpose you can think of. Constructing the exception in this
* manner makes the exception behave in the normal way - i.e., as
* documented in the class "Throwable". The fields "errorToken",
* "expectedTokenSequences", and "tokenImage" do not contain
* relevant information. The JavaCC generated code does not use
* these constructors.
*/
public ParseException() {
super();
}
/** Constructor with message. */
public ParseException(String message) {
super(message);
}
/**
* This is the last token that has been consumed successfully. If
* this object has been created due to a parse error, the token
* followng this token will (therefore) be the first error token.
*/
public Token currentToken;
/**
* Each entry in this array is an array of integers. Each array
* of integers represents a sequence of tokens (by their ordinal
* values) that is expected at this point of the parse.
*/
public int[][] expectedTokenSequences;
/**
* This is a reference to the "tokenImage" array of the generated
* parser within which the parse error occurred. This array is
* defined in the generated ...Constants interface.
*/
public String[] tokenImage;
/**
* It uses "currentToken" and "expectedTokenSequences" to generate a parse
* error message and returns it. If this object has been created
* due to a parse error, and you do not catch it (it gets thrown
* from the parser) the correct error message
* gets displayed.
*/
private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
if (maxSize < expectedTokenSequences[i].length) {
maxSize = expectedTokenSequences[i].length;
}
for (int j = 0; j < expectedTokenSequences[i].length; j++) {
expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' ');
}
if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
expected.append("...");
}
expected.append(eol).append(" ");
}
String retval = "Encountered \"";
Token tok = currentToken.next;
for (int i = 0; i < maxSize; i++) {
if (i != 0) retval += " ";
if (tok.kind == 0) {
retval += tokenImage[0];
break;
}
retval += " " + tokenImage[tok.kind];
retval += " \"";
retval += add_escapes(tok.image);
retval += " \"";
tok = tok.next;
}
retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
retval += "." + eol;
if (expectedTokenSequences.length == 1) {
retval += "Was expecting:" + eol + " ";
} else {
retval += "Was expecting one of:" + eol + " ";
}
retval += expected.toString();
return retval;
}
/**
* The end of line string for this machine.
*/
protected String eol = System.getProperty("line.separator", "\n");
/**
* Used to convert raw characters to their escaped version
* when these raw version cannot be used as part of an ASCII
* string literal.
*/
static String add_escapes(String str) {
StringBuffer retval = new StringBuffer();
char ch;
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i))
{
case 0 :
continue;
case '\b':
retval.append("\\b");
continue;
case '\t':
retval.append("\\t");
continue;
case '\n':
retval.append("\\n");
continue;
case '\f':
retval.append("\\f");
continue;
case '\r':
retval.append("\\r");
continue;
case '\"':
retval.append("\\\"");
continue;
case '\'':
retval.append("\\\'");
continue;
case '\\':
retval.append("\\\\");
continue;
default:
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
String s = "0000" + Integer.toString(ch, 16);
retval.append("\\u" + s.substring(s.length() - 4, s.length()));
} else {
retval.append(ch);
}
continue;
}
}
return retval.toString();
}
}
/* JavaCC - OriginalChecksum=8bf457475d51945ef1f6aaf5ba8a156d (do not edit this line) */

BIN
lib/Parser/scenarios/parser/SimpleCharStream.class

Binary file not shown.

471
lib/Parser/scenarios/parser/SimpleCharStream.java

@ -1,471 +0,0 @@
/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package scenarios.parser;
/**
* An implementation of interface CharStream, where the stream is assumed to
* contain only ASCII characters (without unicode processing).
*/
public class SimpleCharStream
{
/** Whether parser is static. */
public static final boolean staticFlag = false;
int bufsize;
int available;
int tokenBegin;
/** Position in buffer. */
public int bufpos = -1;
protected int bufline[];
protected int bufcolumn[];
protected int column = 0;
protected int line = 1;
protected boolean prevCharIsCR = false;
protected boolean prevCharIsLF = false;
protected java.io.Reader inputStream;
protected char[] buffer;
protected int maxNextCharInd = 0;
protected int inBuf = 0;
protected int tabSize = 8;
protected void setTabSize(int i) { tabSize = i; }
protected int getTabSize(int i) { return tabSize; }
protected void ExpandBuff(boolean wrapAround)
{
char[] newbuffer = new char[bufsize + 2048];
int newbufline[] = new int[bufsize + 2048];
int newbufcolumn[] = new int[bufsize + 2048];
try
{
if (wrapAround)
{
System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
buffer = newbuffer;
System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
bufline = newbufline;
System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
bufcolumn = newbufcolumn;
maxNextCharInd = (bufpos += (bufsize - tokenBegin));
}
else
{
System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
buffer = newbuffer;
System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
bufline = newbufline;
System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
bufcolumn = newbufcolumn;
maxNextCharInd = (bufpos -= tokenBegin);
}
}
catch (Throwable t)
{
throw new Error(t.getMessage());
}
bufsize += 2048;
available = bufsize;
tokenBegin = 0;
}
protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxNextCharInd = 0;
else
ExpandBuff(false);
}
else if (available > tokenBegin)
available = bufsize;
else if ((tokenBegin - available) < 2048)
ExpandBuff(true);
else
available = tokenBegin;
}
int i;
try {
if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1)
{
inputStream.close();
throw new java.io.IOException();
}
else
maxNextCharInd += i;
return;
}
catch(java.io.IOException e) {
--bufpos;
backup(0);
if (tokenBegin == -1)
tokenBegin = bufpos;
throw e;
}
}
/** Start. */
public char BeginToken() throws java.io.IOException
{
tokenBegin = -1;
char c = readChar();
tokenBegin = bufpos;
return c;
}
protected void UpdateLineColumn(char c)
{
column++;
if (prevCharIsLF)
{
prevCharIsLF = false;
line += (column = 1);
}
else if (prevCharIsCR)
{
prevCharIsCR = false;
if (c == '\n')
{
prevCharIsLF = true;
}
else
line += (column = 1);
}
switch (c)
{
case '\r' :
prevCharIsCR = true;
break;
case '\n' :
prevCharIsLF = true;
break;
case '\t' :
column--;
column += (tabSize - (column % tabSize));
break;
default :
break;
}
bufline[bufpos] = line;
bufcolumn[bufpos] = column;
}
/** Read a character. */
public char readChar() throws java.io.IOException
{
if (inBuf > 0)
{
--inBuf;
if (++bufpos == bufsize)
bufpos = 0;
return buffer[bufpos];
}
if (++bufpos >= maxNextCharInd)
FillBuff();
char c = buffer[bufpos];
UpdateLineColumn(c);
return c;
}
@Deprecated
/**
* @deprecated
* @see #getEndColumn
*/
public int getColumn() {
return bufcolumn[bufpos];
}
@Deprecated
/**
* @deprecated
* @see #getEndLine
*/
public int getLine() {
return bufline[bufpos];
}
/** Get token end column number. */
public int getEndColumn() {
return bufcolumn[bufpos];
}
/** Get token end line number. */
public int getEndLine() {
return bufline[bufpos];
}
/** Get token beginning column number. */
public int getBeginColumn() {
return bufcolumn[tokenBegin];
}
/** Get token beginning line number. */
public int getBeginLine() {
return bufline[tokenBegin];
}
/** Backup a number of characters. */
public void backup(int amount) {
inBuf += amount;
if ((bufpos -= amount) < 0)
bufpos += bufsize;
}
/** Constructor. */
public SimpleCharStream(java.io.Reader dstream, int startline,
int startcolumn, int buffersize)
{
inputStream = dstream;
line = startline;
column = startcolumn - 1;
available = bufsize = buffersize;
buffer = new char[buffersize];
bufline = new int[buffersize];
bufcolumn = new int[buffersize];
}
/** Constructor. */
public SimpleCharStream(java.io.Reader dstream, int startline,
int startcolumn)
{
this(dstream, startline, startcolumn, 4096);
}
/** Constructor. */
public SimpleCharStream(java.io.Reader dstream)
{
this(dstream, 1, 1, 4096);
}
/** Reinitialise. */
public void ReInit(java.io.Reader dstream, int startline,
int startcolumn, int buffersize)
{
inputStream = dstream;
line = startline;
column = startcolumn - 1;
if (buffer == null || buffersize != buffer.length)
{
available = bufsize = buffersize;
buffer = new char[buffersize];
bufline = new int[buffersize];
bufcolumn = new int[buffersize];
}
prevCharIsLF = prevCharIsCR = false;
tokenBegin = inBuf = maxNextCharInd = 0;
bufpos = -1;
}
/** Reinitialise. */
public void ReInit(java.io.Reader dstream, int startline,
int startcolumn)
{
ReInit(dstream, startline, startcolumn, 4096);
}
/** Reinitialise. */
public void ReInit(java.io.Reader dstream)
{
ReInit(dstream, 1, 1, 4096);
}
/** Constructor. */
public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
{
this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
}
/** Constructor. */
public SimpleCharStream(java.io.InputStream dstream, int startline,
int startcolumn, int buffersize)
{
this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
}
/** Constructor. */
public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
int startcolumn) throws java.io.UnsupportedEncodingException
{
this(dstream, encoding, startline, startcolumn, 4096);
}
/** Constructor. */
public SimpleCharStream(java.io.InputStream dstream, int startline,
int startcolumn)
{
this(dstream, startline, startcolumn, 4096);
}
/** Constructor. */
public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
{
this(dstream, encoding, 1, 1, 4096);
}
/** Constructor. */
public SimpleCharStream(java.io.InputStream dstream)
{
this(dstream, 1, 1, 4096);
}
/** Reinitialise. */
public void ReInit(java.io.InputStream dstream, String encoding, int startline,
int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
{
ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
}
/** Reinitialise. */
public void ReInit(java.io.InputStream dstream, int startline,
int startcolumn, int buffersize)
{
ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
}
/** Reinitialise. */
public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
{
ReInit(dstream, encoding, 1, 1, 4096);
}
/** Reinitialise. */
public void ReInit(java.io.InputStream dstream)
{
ReInit(dstream, 1, 1, 4096);
}
/** Reinitialise. */
public void ReInit(java.io.InputStream dstream, String encoding, int startline,
int startcolumn) throws java.io.UnsupportedEncodingException
{
ReInit(dstream, encoding, startline, startcolumn, 4096);
}
/** Reinitialise. */
public void ReInit(java.io.InputStream dstream, int startline,
int startcolumn)
{
ReInit(dstream, startline, startcolumn, 4096);
}
/** Get token literal value. */
public String GetImage()
{
if (bufpos >= tokenBegin)
return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
else
return new String(buffer, tokenBegin, bufsize - tokenBegin) +
new String(buffer, 0, bufpos + 1);
}
/** Get the suffix. */
public char[] GetSuffix(int len)
{
char[] ret = new char[len];
if ((bufpos + 1) >= len)
System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
else
{
System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
len - bufpos - 1);
System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
}
return ret;
}
/** Reset buffer when finished. */
public void Done()
{
buffer = null;
bufline = null;
bufcolumn = null;
}
/**
* Method to adjust line and column numbers for the start of a token.
*/
public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextColDiff = 0, columnDiff = 0;
while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
{
bufline[j] = newLine;
nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
bufcolumn[j] = newCol + columnDiff;
columnDiff = nextColDiff;
i++;
}
if (i < len)
{
bufline[j] = newLine++;
bufcolumn[j] = newCol + columnDiff;
while (i++ < len)
{
if (bufline[j = start % bufsize] != bufline[++start % bufsize])
bufline[j] = newLine++;
else
bufline[j] = newLine;
}
}
line = bufline[j];
column = bufcolumn[j];
}
}
/* JavaCC - OriginalChecksum=42feb3a1674addb0151e2ca3c012bebc (do not edit this line) */

BIN
lib/Parser/scenarios/parser/Token.class

Binary file not shown.

131
lib/Parser/scenarios/parser/Token.java

@ -1,131 +0,0 @@
/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package scenarios.parser;
/**
* Describes the input token stream.
*/
public class Token implements java.io.Serializable {
/**
* The version identifier for this Serializable class.
* Increment only if the <i>serialized</i> form of the
* class changes.
*/
private static final long serialVersionUID = 1L;
/**
* An integer that describes the kind of this token. This numbering
* system is determined by JavaCCParser, and a table of these numbers is
* stored in the file ...Constants.java.
*/
public int kind;
/** The line number of the first character of this Token. */
public int beginLine;
/** The column number of the first character of this Token. */
public int beginColumn;
/** The line number of the last character of this Token. */
public int endLine;
/** The column number of the last character of this Token. */
public int endColumn;
/**
* The string image of the token.
*/
public String image;
/**
* A reference to the next regular (non-special) token from the input
* stream. If this is the last token from the input stream, or if the
* token manager has not read tokens beyond this one, this field is
* set to null. This is true only if this token is also a regular
* token. Otherwise, see below for a description of the contents of
* this field.
*/
public Token next;
/**
* This field is used to access special tokens that occur prior to this
* token, but after the immediately preceding regular (non-special) token.
* If there are no such special tokens, this field is set to null.
* When there are more than one such special token, this field refers
* to the last of these special tokens, which in turn refers to the next
* previous special token through its specialToken field, and so on
* until the first special token (whose specialToken field is null).
* The next fields of special tokens refer to other special tokens that
* immediately follow it (without an intervening regular token). If there
* is no such token, this field is null.
*/
public Token specialToken;
/**
* An optional attribute value of the Token.
* Tokens which are not used as syntactic sugar will often contain
* meaningful values that will be used later on by the compiler or
* interpreter. This attribute value is often different from the image.
* Any subclass of Token that actually wants to return a non-null value can
* override this method as appropriate.
*/
public Object getValue() {
return null;
}
/**
* No-argument constructor
*/
public Token() {}
/**
* Constructs a new token for the specified Image.
*/
public Token(int kind)
{
this(kind, null);
}
/**
* Constructs a new token for the specified Image and Kind.
*/
public Token(int kind, String image)
{
this.kind = kind;
this.image = image;
}
/**
* Returns the image.
*/
public String toString()
{
return image;
}
/**
* Returns a new Token object, by default. However, if you want, you
* can create and return subclass objects based on the value of ofKind.
* Simply add the cases to the switch for all those special cases.
* For example, if you have a subclass of Token called IDToken that
* you want to create if ofKind is ID, simply add something like :
*
* case MyParserConstants.ID : return new IDToken(ofKind, image);
*
* to the following switch statement. Then you can cast matchedToken
* variable to the appropriate type and use sit in your lexical actions.
*/
public static Token newToken(int ofKind, String image)
{
switch(ofKind)
{
default : return new Token(ofKind, image);
}
}
public static Token newToken(int ofKind)
{
return newToken(ofKind, null);
}
}
/* JavaCC - OriginalChecksum=700addb7505d549473af9e4677f83636 (do not edit this line) */

BIN
lib/Parser/scenarios/parser/TokenMgrError.class

Binary file not shown.

147
lib/Parser/scenarios/parser/TokenMgrError.java

@ -1,147 +0,0 @@
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
/* JavaCCOptions: */
package scenarios.parser;
/** Token Manager Error. */
public class TokenMgrError extends Error
{
/**
* The version identifier for this Serializable class.
* Increment only if the <i>serialized</i> form of the
* class changes.
*/
private static final long serialVersionUID = 1L;
/*
* Ordinals for various reasons why an Error of this type can be thrown.
*/
/**
* Lexical error occurred.
*/
static final int LEXICAL_ERROR = 0;
/**
* An attempt was made to create a second instance of a static token manager.
*/
static final int STATIC_LEXER_ERROR = 1;
/**
* Tried to change to an invalid lexical state.
*/
static final int INVALID_LEXICAL_STATE = 2;
/**
* Detected (and bailed out of) an infinite loop in the token manager.
*/
static final int LOOP_DETECTED = 3;
/**
* Indicates the reason why the exception is thrown. It will have
* one of the above 4 values.
*/
int errorCode;
/**
* Replaces unprintable characters by their escaped (or unicode escaped)
* equivalents in the given string
*/
protected static final String addEscapes(String str) {
StringBuffer retval = new StringBuffer();
char ch;
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i))
{
case 0 :
continue;
case '\b':
retval.append("\\b");
continue;
case '\t':
retval.append("\\t");
continue;
case '\n':
retval.append("\\n");
continue;
case '\f':
retval.append("\\f");
continue;
case '\r':
retval.append("\\r");
continue;
case '\"':
retval.append("\\\"");
continue;
case '\'':
retval.append("\\\'");
continue;
case '\\':
retval.append("\\\\");
continue;
default:
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
String s = "0000" + Integer.toString(ch, 16);
retval.append("\\u" + s.substring(s.length() - 4, s.length()));
} else {
retval.append(ch);
}
continue;
}
}
return retval.toString();
}
/**
* Returns a detailed message for the Error when it is thrown by the
* token manager to indicate a lexical error.