Package: eclipse-wtp / 3.6.0-1

regenerate-js-parser-resources.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
From: Jakub Adam <jakub.adam@ktknet.cz>
Date: Thu, 22 Dec 2011 15:32:16 +0100
Subject: regenerate-js-parser-resources

- put markers around generated code (helps its replacement in d/rules)
- do not Parser.initTables() when running UpdateParserFiles, as we don't
  have table data yet
---
 .../eclipse/wst/jsdt/internal/compiler/parser/Parser.java    | 12 +++++++++---
 .../wst/jsdt/internal/compiler/parser/TerminalTokens.java    |  5 +++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/parser/Parser.java b/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/parser/Parser.java
index cedf049..b66796f 100644
--- a/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/parser/Parser.java
+++ b/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/parser/Parser.java
@@ -327,8 +327,10 @@ public class Parser implements  ParserBasicInformation, TerminalTokens, Operator
 	public IInferEngine[] inferenceEngines;
 	
 	static {
+		StackTraceElement[] trace = Thread.currentThread().getStackTrace();
 		try{
-			initTables();
+			if (!trace[trace.length - 1].getClassName().endsWith("UpdateParserFiles"))
+				initTables();
 		} catch(java.io.IOException ex){
 			throw new ExceptionInInitializerError(ex.getMessage());
 		}
@@ -764,7 +766,7 @@ public final static void buildFilesFromLPG(String dataFilename, String dataFilen
 
 	buildFilesForFlags(
 			prefix + (++i) + ".rsc", //$NON-NLS-1$
-			rhs.length,
+			newRhs.length,
 			tokens);
 
 
@@ -2791,7 +2793,9 @@ protected void consumePostDoc() {
 	}
 }
 
-//This method is part of an automatic generation : do NOT edit-modify  
+// ### BEGIN GENERATED CODE ###
+
+//This method is part of an automatic generation : do NOT edit-modify  
 protected void consumeRule(int act) {
 switch ( act ) {
  case 23 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); }  //$NON-NLS-1$
@@ -3752,6 +3756,8 @@ consumeMethodDeclaration(false);
 	}
 }
 
+// ### END GENERATED CODE ###
+
 private void consumeElisionList() {
 	int flag=this.intStack[this.intPtr];
 	if ((flag&UNCONSUMED_ELISION)!=0)
diff --git a/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/parser/TerminalTokens.java b/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/parser/TerminalTokens.java
index c6b1a9b..4539354 100644
--- a/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/parser/TerminalTokens.java
+++ b/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/parser/TerminalTokens.java
@@ -34,6 +34,8 @@ public interface TerminalTokens {
 		TokenNameCOMMENT_JAVADOC = 1003,
 		TokenNameUNKNOWN = 1004;
 
+// ### BEGIN GENERATED CODE ###
+
     int TokenNameIdentifier = 32,
 		TokenNameabstract = 88,
 		TokenNameboolean = 89,
@@ -154,4 +156,7 @@ public interface TerminalTokens {
 		TokenNameEQUAL = 71,
 		TokenNameEOF = 70,
 		TokenNameERROR = 120;
+
+// ### END GENERATED CODE ###
+
 }