diff --git a/app/Base.java b/app/Base.java index 4b8e6e016..ff93af765 100644 --- a/app/Base.java +++ b/app/Base.java @@ -54,7 +54,7 @@ import processing.core.*; */ public class Base { static final int VERSION = 10; - static final String VERSION_NAME = "0010 Alpha"; + static final String VERSION_NAME = "0011 Alpha"; /** * Path of filename opened on the command line, @@ -172,7 +172,7 @@ public class Base { /** * returns true if the Arduino is running on a Mac OS machine, - * specifically a Mac OS X machine because it doesn't un on OS 9 anymore. + * specifically a Mac OS X machine because it doesn't run on OS 9 anymore. */ static public boolean isMacOS() { return PApplet.platform == PConstants.MACOSX; @@ -877,18 +877,20 @@ public class Base { static public String getContents(String what) { String basePath = System.getProperty("user.dir"); - /* - // do this later, when moving to .app package - if (PApplet.platform == PConstants.MACOSX) { - basePath = System.getProperty("processing.contents"); - } - */ return basePath + File.separator + what; } - static public String getLibContents(String what) { - return getContents("lib" + File.separator + what); + /* On MacOSX, the arduino.app-resources property points to the + * resources directory inside the app bundle. On other platforms + * it's not set. + */ + String appResources = System.getProperty("arduino.app-resources"); + if (appResources != null) { + return appResources + File.separator + what; + } else { + return getContents("lib" + File.separator + what); + } } diff --git a/app/Compiler.java b/app/Compiler.java index 5ab96f635..4d4b01b59 100644 --- a/app/Compiler.java +++ b/app/Compiler.java @@ -85,7 +85,7 @@ public class Compiler implements MessageConsumer { // } catch (IOException e) { // throw new RunnerException(e.getMessage()); // } - String avrBasePath; + String avrBasePath; if(Base.isMacOS()) { avrBasePath = new String("hardware/tools/avr/bin/"); } @@ -97,7 +97,7 @@ public class Compiler implements MessageConsumer { } - String preCommandCompiler[] = new String[] { + List baseCommandCompiler = new ArrayList(Arrays.asList(new String[] { avrBasePath + "avr-gcc", "-c", // compile, don't link "-g", // include debugging info (so errors include line numbers) @@ -106,23 +106,14 @@ public class Compiler implements MessageConsumer { "-w", // surpress all warnings "-mmcu=" + Preferences.get("boards." + Preferences.get("board") + ".build.mcu"), "-DF_CPU=" + Preferences.get("boards." + Preferences.get("board") + ".build.f_cpu"), - }; + })); // use lib directories as include paths - //String[] libDirs = libraryManager.getFolderPaths(); - String[] libDirs = new String[sketch.importedLibraries.size()]; - - for (int i = 0; i < sketch.importedLibraries.size(); i++) - libDirs[i] = ((Library) sketch.importedLibraries.get(i)).getFolder().getPath(); - - // Last two arguments will specify the file being compiled and the output file. - String[] baseCommandCompiler = new String[preCommandCompiler.length + libDirs.length + 2]; - System.arraycopy(preCommandCompiler, 0, baseCommandCompiler, 0, preCommandCompiler.length); - for (int i = 0; i < libDirs.length; ++i) { - baseCommandCompiler[preCommandCompiler.length + i] = "-I" + libDirs[i]; + for (int i = 0; i < sketch.importedLibraries.size(); i++) { + baseCommandCompiler.add("-I" + ((Library) sketch.importedLibraries.get(i)).getFolder().getPath()); } - - String preCommandCompilerCPP[] = new String[] { + + List baseCommandCompilerCPP = new ArrayList(Arrays.asList(new String[] { avrBasePath + "avr-g++", "-c", // compile, don't link "-g", // include debugging info (so errors include line numbers) @@ -132,196 +123,83 @@ public class Compiler implements MessageConsumer { "-fno-exceptions", "-mmcu=" + Preferences.get("boards." + Preferences.get("board") + ".build.mcu"), "-DF_CPU=" + Preferences.get("boards." + Preferences.get("board") + ".build.f_cpu"), - }; + })); // use lib directories as include paths - // Last two arguments will specify the file being compiled and the output file. - String[] baseCommandCompilerCPP = new String[preCommandCompilerCPP.length + libDirs.length + 2]; - System.arraycopy(preCommandCompilerCPP, 0, baseCommandCompilerCPP, 0, preCommandCompilerCPP.length); - for (int i = 0; i < libDirs.length; ++i) { - baseCommandCompilerCPP[preCommandCompilerCPP.length + i] = "-I" + libDirs[i]; + for (int i = 0; i < sketch.importedLibraries.size(); ++i) { + baseCommandCompilerCPP.add("-I" + ((Library) sketch.importedLibraries.get(i)).getFolder().getPath()); } - String preCommandLinker[] = new String[] { + List baseCommandLinker = new ArrayList(Arrays.asList(new String[] { avrBasePath + "avr-gcc", - " ", + "-Os", "-mmcu=" + Preferences.get("boards." + Preferences.get("board") + ".build.mcu"), "-o", - " ", - }; + ((!Base.isMacOS()) ? buildPath : buildPath) + File.separator + sketch.name + ".elf" + })); String runtimeLibraryName = buildPath + File.separator + "core.a"; - String baseCommandAR[] = new String[] { + List baseCommandAR = new ArrayList(Arrays.asList(new String[] { avrBasePath + "avr-ar", "rcs", - runtimeLibraryName, - " " - }; + runtimeLibraryName + })); - // use lib object files during include - //String[] libObjectFiles = libraryManager.getObjectFiles(); - - Vector libObjectFilesVec = new Vector(); - + // use lib object files for (Iterator i = sketch.importedLibraries.iterator(); i.hasNext(); ) { Library library = (Library) i.next(); File[] objectFiles = library.getObjectFiles(); for (int j = 0; j < objectFiles.length; j++) - libObjectFilesVec.add(objectFiles[j].getPath()); + baseCommandLinker.add(objectFiles[j].getPath()); } - String[] libObjectFiles = new String[libObjectFilesVec.size()]; - libObjectFiles = (String[]) libObjectFilesVec.toArray(libObjectFiles); - - String[] baseCommandLinker = new String[preCommandLinker.length + libObjectFiles.length]; - System.arraycopy(preCommandLinker, 0, baseCommandLinker, 0, preCommandLinker.length); - for (int i = 0; i < libObjectFiles.length; ++i) { - baseCommandLinker[preCommandLinker.length + i] = libObjectFiles[i]; - } - - String baseCommandObjcopy[] = new String[] { + List baseCommandObjcopy = new ArrayList(Arrays.asList(new String[] { avrBasePath + "avr-objcopy", "-O", - " ", "-R", - " ", - " ", - " " - }; - - /*String baseCommand[] = new String[] { - // user.dir is folder containing P5 (and therefore jikes) - // macosx needs the extra path info. linux doesn't like it, though - // windows doesn't seem to care. write once, headache anywhere. - ((!Base.isMacOS()) ? "jikes" : - System.getProperty("user.dir") + File.separator + "jikes"), - - // this doesn't help much.. also java 1.4 seems to not support - // -source 1.1 for javac, and jikes seems to also have dropped it. - // for versions of jikes that don't complain, "final int" inside - // a function doesn't throw an error, so it could just be a - // ms jvm error that this sort of thing doesn't work. blech. - //"-source", - //"1.1", - - // necessary to make output classes compatible with 1.1 - // i.e. so that exported applets can work with ms jvm on the web - "-target", - Preferences.get("preproc.jdk_version"), //"1.1", - // let the incompatability headache begin - - // used when run without a vm ("expert" mode) - "-bootclasspath", - calcBootClassPath(), - - // needed for macosx so that the classpath is set properly - // also for windows because qtjava will most likely be here - // and for linux, it just doesn't hurt - "-classpath", - sketch.classPath, //calcClassPath(includeFolder), - - "-nowarn", // we're not currently interested in warnings - "+E", // output errors in machine-parsable format - "-d", buildPath // output the classes in the buildPath - //buildPath + File.separator + className + ".java" // file to compile - };*/ + })); // make list of code files that need to be compiled and the object files // that they will be compiled to (includes code from the sketch and the // library for the target platform) - String sourceNames[] = new String[sketch.codeCount + target.getSourceFilenames().size()]; - String sourceNamesCPP[] = new String[sketch.codeCount + target.getSourceFilenames().size()]; - String objectNames[] = new String[sketch.codeCount + target.getSourceFilenames().size()]; - String objectNamesCPP[] = new String[sketch.codeCount + target.getSourceFilenames().size()]; - String targetObjectNames[] = new String[target.getSourceFilenames().size()]; - String sketchObjectNames[] = new String[sketch.codeCount]; - int fileCount = 0; - int fileCountCPP = 0; - int targetCount = 0; - int sketchCount = 0; + List sourceNames = new ArrayList(); + List sourceNamesCPP = new ArrayList(); + List objectNames = new ArrayList(); + List objectNamesCPP = new ArrayList(); + List targetObjectNames = new ArrayList(); + List sketchObjectNames = new ArrayList(); for (int i = 0; i < sketch.codeCount; i++) { if (sketch.code[i].preprocName != null) { if (sketch.code[i].preprocName.endsWith(".c")) { - sourceNames[fileCount] = buildPath + File.separator + sketch.code[i].preprocName; - objectNames[fileCount++] = buildPath + File.separator + sketch.code[i].preprocName + ".o"; - sketchObjectNames[sketchCount++] = buildPath + File.separator + sketch.code[i].preprocName + ".o"; + sourceNames.add(buildPath + File.separator + sketch.code[i].preprocName); + objectNames.add(buildPath + File.separator + sketch.code[i].preprocName + ".o"); + sketchObjectNames.add(buildPath + File.separator + sketch.code[i].preprocName + ".o"); } else if (sketch.code[i].preprocName.endsWith(".cpp")) { - sourceNamesCPP[fileCountCPP] = buildPath + File.separator + sketch.code[i].preprocName; - objectNamesCPP[fileCountCPP++] = buildPath + File.separator + sketch.code[i].preprocName + ".o"; - sketchObjectNames[sketchCount++] = buildPath + File.separator + sketch.code[i].preprocName + ".o"; + sourceNamesCPP.add(buildPath + File.separator + sketch.code[i].preprocName); + objectNamesCPP.add(buildPath + File.separator + sketch.code[i].preprocName + ".o"); + sketchObjectNames.add(buildPath + File.separator + sketch.code[i].preprocName + ".o"); } } } for (Iterator iter = target.getSourceFilenames().iterator(); iter.hasNext(); ) { String filename = (String) iter.next(); if (filename != null) { - targetObjectNames[targetCount++] = buildPath + File.separator + filename + ".o"; + targetObjectNames.add(buildPath + File.separator + filename + ".o"); if (filename.endsWith(".c")) { - sourceNames[fileCount] = target.getPath() + File.separator + filename; - objectNames[fileCount++] = buildPath + File.separator + filename + ".o"; + sourceNames.add(target.getPath() + File.separator + filename); + objectNames.add(buildPath + File.separator + filename + ".o"); } else if (filename.endsWith(".cpp")) { - sourceNamesCPP[fileCountCPP] = target.getPath() + File.separator + filename; - objectNamesCPP[fileCountCPP++] = buildPath + File.separator + filename + ".o"; + sourceNamesCPP.add(target.getPath() + File.separator + filename); + objectNamesCPP.add(buildPath + File.separator + filename + ".o"); } } } - - /* - String commandCompiler[] = new String[baseCommandCompiler.length + preprocCount]; - System.arraycopy(baseCommandCompiler, 0, commandCompiler, 0, baseCommandCompiler.length); - // append each of the files to the command string - for (int i = 0; i < preprocCount; i++) { - commandCompiler[baseCommandCompiler.length + i] = - buildPath + File.separator + preprocNames[i]; - } - - String commandCompilerCPP[] = new String[baseCommandCompilerCPP.length + preprocCountCPP]; - System.arraycopy(baseCommandCompilerCPP, 0, commandCompilerCPP, 0, baseCommandCompilerCPP.length); - for (int i = 0; i < preprocCountCPP; i++) { - commandCompilerCPP[baseCommandCompilerCPP.length + i] = - buildPath + File.separator + preprocNamesCPP[i]; - } - */ - //PApplet.printarr(command); - - baseCommandLinker[1] = "-Os"; - baseCommandLinker[4] = ((!Base.isMacOS()) ? buildPath - : buildPath) + File.separator + sketch.name + ".elf"; - String commandLinker[] = new String[baseCommandLinker.length + sketchCount + 3]; - System.arraycopy(baseCommandLinker, 0, commandLinker, 0, baseCommandLinker.length); - int idx = 0; - for(int i = 0; i < sketchCount; i++, idx++) { - commandLinker[baseCommandLinker.length + idx] = sketchObjectNames[i]; - } - - commandLinker[baseCommandLinker.length + idx++] = runtimeLibraryName; - commandLinker[baseCommandLinker.length + idx++] = "-L" + buildPath; - commandLinker[baseCommandLinker.length + idx] = "-lm"; - - /*String command[] = new String[baseCommand.length + preprocCount]; - System.arraycopy(baseCommand, 0, command, 0, baseCommand.length); - // append each of the files to the command string - for (int i = 0; i < preprocCount; i++) { - command[baseCommand.length + i] = - buildPath + File.separator + preprocNames[i]; - } - //PApplet.printarr(command); - */ - /* - String command[] = new String[baseCommand.length + sketch.codeCount]; - System.arraycopy(baseCommand, 0, command, 0, baseCommand.length); - // append each of the files to the command string - for (int i = 0; i < sketch.codeCount; i++) { - command[baseCommand.length + i] = - buildPath + File.separator + sketch.code[i].preprocName; - } - */ - - //for (int i = 0; i < command.length; i++) { - //System.out.println("cmd " + i + " " + command[i]); - //} + baseCommandLinker.addAll(sketchObjectNames); + baseCommandLinker.add(runtimeLibraryName); + baseCommandLinker.add("-L" + buildPath); + baseCommandLinker.add("-lm"); firstErrorFound = false; // haven't found any errors yet secondErrorFound = false; @@ -334,48 +212,48 @@ public class Compiler implements MessageConsumer { Process process; boolean compiling = true; - for(int i = 0; i < fileCount; i++) { - baseCommandCompiler[baseCommandCompiler.length - 2] = sourceNames[i]; - baseCommandCompiler[baseCommandCompiler.length - 1] = "-o"+ objectNames[i]; - //System.arraycopy(baseCommandCompiler.length - result = execAsynchronously(baseCommandCompiler); - if (result!=0) + for(int i = 0; i < sourceNames.size(); i++) { + List commandCompiler = new ArrayList(baseCommandCompiler); + commandCompiler.add(sourceNames.get(i)); + commandCompiler.add("-o"+ objectNames.get(i)); + if (execAsynchronously(commandCompiler) != 0) return false; } - for(int i = 0; i < fileCountCPP; i++) { - baseCommandCompilerCPP[baseCommandCompilerCPP.length - 2] = sourceNamesCPP[i]; - baseCommandCompilerCPP[baseCommandCompilerCPP.length - 1] = "-o"+ objectNamesCPP[i]; - result = execAsynchronously(baseCommandCompilerCPP); - if (result!=0) + for(int i = 0; i < sourceNamesCPP.size(); i++) { + List commandCompilerCPP = new ArrayList(baseCommandCompilerCPP); + commandCompilerCPP.add(sourceNamesCPP.get(i)); + commandCompilerCPP.add("-o"+ objectNamesCPP.get(i)); + if (execAsynchronously(commandCompilerCPP) != 0) return false; } - for(int i = 0; i < targetCount; i++) { - baseCommandAR[baseCommandAR.length - 1] = targetObjectNames[i]; - result = execAsynchronously(baseCommandAR); - if(result!=0) + for(int i = 0; i < targetObjectNames.size(); i++) { + List commandAR = new ArrayList(baseCommandAR); + commandAR.add(targetObjectNames.get(i)); + if (execAsynchronously(commandAR) != 0) return false; } - result = execAsynchronously(commandLinker); - if (result!=0) + if (execAsynchronously(baseCommandLinker) != 0) return false; - baseCommandObjcopy[2] = "srec"; - baseCommandObjcopy[4] = ".eeprom"; - baseCommandObjcopy[5] = buildPath + File.separator + sketch.name + ".elf"; - baseCommandObjcopy[6] = buildPath + File.separator + sketch.name + ".rom"; - result = execAsynchronously(baseCommandObjcopy); - if (result!=0) + List commandObjcopy; + + commandObjcopy = new ArrayList(baseCommandObjcopy); + commandObjcopy.add(2, "srec"); + commandObjcopy.add(".eeprom"); + commandObjcopy.add(buildPath + File.separator + sketch.name + ".elf"); + commandObjcopy.add(buildPath + File.separator + sketch.name + ".rom"); + if (execAsynchronously(commandObjcopy) != 0) return false; - baseCommandObjcopy[2] = "ihex"; - baseCommandObjcopy[4] = ".flash"; - baseCommandObjcopy[5] = buildPath + File.separator + sketch.name + ".elf"; - baseCommandObjcopy[6] = buildPath + File.separator + sketch.name + ".hex"; - result = execAsynchronously(baseCommandObjcopy); - if (result!=0) + commandObjcopy = new ArrayList(baseCommandObjcopy); + commandObjcopy.add(2, "ihex"); + commandObjcopy.add(".flash"); + commandObjcopy.add(buildPath + File.separator + sketch.name + ".elf"); + commandObjcopy.add(buildPath + File.separator + sketch.name + ".hex"); + if (execAsynchronously(commandObjcopy) != 0) return false; } catch (Exception e) { String msg = e.getMessage(); @@ -383,8 +261,7 @@ public class Compiler implements MessageConsumer { //System.err.println("jikes is missing"); Base.showWarning("Compiler error", "Could not find the compiler.\n" + - "avr-gcc is missing from your PATH,\n" + - "see readme.txt for help.", null); + "avr-gcc is missing from your PATH.", null); return false; } else { @@ -415,8 +292,10 @@ public class Compiler implements MessageConsumer { return (result == 0); // ? true : false; } - public int execAsynchronously(String[] command) + public int execAsynchronously(List commandList) throws RunnerException, IOException { + String[] command = new String[commandList.size()]; + commandList.toArray(command); int result = 0; if (Preferences.getBoolean("build.verbose")) { diff --git a/app/Editor.java b/app/Editor.java index 9e5635b39..8029fdf0f 100644 --- a/app/Editor.java +++ b/app/Editor.java @@ -838,7 +838,7 @@ public class Editor extends JFrame } JCheckBoxMenuItem item = (JCheckBoxMenuItem)e.getSource(); item.setState(true); - String name = item.getLabel(); + String name = item.getText(); //System.out.println(item.getLabel()); Preferences.set("serial.port", name); //System.out.println("set to " + get("serial.port")); diff --git a/app/EditorButtons.java b/app/EditorButtons.java index 3867d271a..781902606 100644 --- a/app/EditorButtons.java +++ b/app/EditorButtons.java @@ -155,7 +155,7 @@ public class EditorButtons extends JComponent implements MouseInputListener { setState(i, INACTIVE, false); } } - Dimension size = size(); + Dimension size = getSize(); if ((offscreen == null) || (size.width != width) || (size.height != height)) { offscreen = createImage(size.width, size.height); diff --git a/app/UpdateCheck.java b/app/UpdateCheck.java index c41004a1b..490867f54 100755 --- a/app/UpdateCheck.java +++ b/app/UpdateCheck.java @@ -82,17 +82,16 @@ public class UpdateCheck implements Runnable { Preferences.set("update.id", String.valueOf(id)); } - String info = - URLEncoder.encode(id + "\t" + + String info = id + "\t" + Base.VERSION+ "\t" + System.getProperty("java.version") + "\t" + System.getProperty("java.vendor") + "\t" + System.getProperty("os.name") + "\t" + System.getProperty("os.version") + "\t" + - System.getProperty("os.arch")); - + System.getProperty("os.arch"); + try { - int latest = readInt(downloadURL + "?" + info); + int latest = readInt(downloadURL + "?" + URLEncoder.encode(info, "UTF-8")); String lastString = Preferences.get("update.last"); long now = System.currentTimeMillis(); diff --git a/app/preproc/CSymbolTable.java b/app/preproc/CSymbolTable.java deleted file mode 100755 index aa752ef0e..000000000 --- a/app/preproc/CSymbolTable.java +++ /dev/null @@ -1,133 +0,0 @@ -package processing.app.preproc; - - -import java.util.Vector; -import java.util.Hashtable; -import java.util.Enumeration; - - - -public class CSymbolTable { - - /** holds list of scopes */ - private Vector scopeStack; - - /** table where all defined names are mapped to TNode tree nodes */ - private Hashtable symTable; - - public CSymbolTable() { - scopeStack = new Vector(10); - symTable = new Hashtable(533); - } - - - /** push a new scope onto the scope stack. - */ - public void pushScope(String s) { - //System.out.println("push scope:" + s); - scopeStack.addElement(s); - } - - /** pop the last scope off the scope stack. - */ - public void popScope() { - //System.out.println("pop scope"); - int size = scopeStack.size(); - if(size > 0) - scopeStack.removeElementAt(size - 1); - } - - /** return the current scope as a string - */ - public String currentScopeAsString() { - StringBuffer buf = new StringBuffer(100); - boolean first = true; - Enumeration e = scopeStack.elements(); - while(e.hasMoreElements()) { - if(first) - first = false; - else - buf.append("::"); - buf.append(e.nextElement().toString()); - } - return buf.toString(); - } - - /** given a name for a type, append it with the - current scope. - */ - public String addCurrentScopeToName(String name) { - String currScope = currentScopeAsString(); - return addScopeToName(currScope, name); - } - - /** given a name for a type, append it with the - given scope. MBZ - */ - public String addScopeToName(String scope, String name) { - if(scope == null || scope.length() > 0) - return scope + "::" + name; - else - return name; - } - - /** remove one level of scope from name MBZ*/ - public String removeOneLevelScope(String scopeName) { - int index = scopeName.lastIndexOf("::"); - if (index > 0) { - return scopeName.substring(0,index); - } - if (scopeName.length() > 0) { - return ""; - } - return null; - } - - /** add a node to the table with it's key as - the current scope and the name */ - public TNode add(String name, TNode node) { - return (TNode)symTable.put(addCurrentScopeToName(name),node); - } - - - /** lookup a fully scoped name in the symbol table */ - public TNode lookupScopedName(String scopedName) { - return (TNode)symTable.get(scopedName); - } - - /** lookup an unscoped name in the table by prepending - the current scope. - MBZ -- if not found, pop scopes and look again - */ - public TNode lookupNameInCurrentScope(String name) { - String scope = currentScopeAsString(); - String scopedName; - TNode tnode = null; - - //System.out.println( "\n"+ this.toString() ); - - while (tnode == null && scope != null) { - scopedName = addScopeToName(scope, name); - //System.out.println("lookup trying " + scopedName); - tnode = (TNode)symTable.get(scopedName); - scope = removeOneLevelScope(scope); - } - return tnode; - } - - /** convert this table to a string */ - public String toString() { - StringBuffer buff = new StringBuffer(300); - buff.append("CSymbolTable { \nCurrentScope: " + currentScopeAsString() + - "\nDefinedSymbols:\n"); - Enumeration ke = symTable.keys(); - Enumeration ve = symTable.elements(); - while(ke.hasMoreElements()) { - buff.append(ke.nextElement().toString() + " (" + - TNode.getNameForType(((TNode)ve.nextElement()).getType()) + ")\n"); - } - buff.append("}\n"); - return buff.toString(); - } - -}; diff --git a/app/preproc/CToken.java b/app/preproc/CToken.java deleted file mode 100755 index 6cdb54206..000000000 --- a/app/preproc/CToken.java +++ /dev/null @@ -1,32 +0,0 @@ -package processing.app.preproc; - -import antlr.CommonToken; - -public class CToken extends antlr.CommonToken { - String source = ""; - int tokenNumber; - - public String getSource() - { - return source; - } - - public void setSource(String src) - { - source = src; - } - - public int getTokenNumber() - { - return tokenNumber; - } - - public void setTokenNumber(int i) - { - tokenNumber = i; - } - - public String toString() { - return "CToken:" +"(" + hashCode() + ")" + "[" + getType() + "] "+ getText() + " line:" + getLine() + " source:" + source ; - } -} diff --git a/app/preproc/ExtendedCommonASTWithHiddenTokens.java b/app/preproc/ExtendedCommonASTWithHiddenTokens.java deleted file mode 100755 index 43519e89c..000000000 --- a/app/preproc/ExtendedCommonASTWithHiddenTokens.java +++ /dev/null @@ -1,132 +0,0 @@ -package antlr; - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/RIGHTS.html - * - * $Id$ - */ - -import java.io.*; -import antlr.*; -import antlr.collections.*; -import antlr.collections.impl.*; - -/** A CommonAST whose initialization copies hidden token - * information from the Token used to create a node. - */ -public class ExtendedCommonASTWithHiddenTokens - extends CommonASTWithHiddenTokens { - - public ExtendedCommonASTWithHiddenTokens() { - super(); - } - - public ExtendedCommonASTWithHiddenTokens(Token tok) { - super(tok); - } - - public void initialize(AST ast) { - ExtendedCommonASTWithHiddenTokens a = - (ExtendedCommonASTWithHiddenTokens)ast; - super.initialize(a); - hiddenBefore = a.getHiddenBefore(); - hiddenAfter = a.getHiddenAfter(); - } - - public String getHiddenAfterString() { - - CommonHiddenStreamToken t; - StringBuffer hiddenAfterString = new StringBuffer(100); - - for ( t = hiddenAfter ; t != null ; t = t.getHiddenAfter() ) { - hiddenAfterString.append(t.getText()); - } - - return hiddenAfterString.toString(); - } - - public String getHiddenBeforeString() { - - antlr.CommonHiddenStreamToken - child = null, - parent = hiddenBefore; - - // if there aren't any hidden tokens here, quietly return - // - if (parent == null) { - return ""; - } - - // traverse back to the head of the list of tokens before this node - do { - child = parent; - parent = child.getHiddenBefore(); - } while (parent != null); - - // dump that list - - StringBuffer hiddenBeforeString = new StringBuffer(100); - - for ( CommonHiddenStreamToken t = child; t != null ; - t = t.getHiddenAfter() ) { - hiddenBeforeString.append(t.getText()); - } - - return hiddenBeforeString.toString(); - } - - public void xmlSerializeNode(Writer out) - throws IOException { - StringBuffer buf = new StringBuffer(100); - buf.append("<"); - buf.append(getClass().getName() + " "); - - buf.append("hiddenBeforeString=\"" + - encode(getHiddenBeforeString()) + - "\" text=\"" + encode(getText()) + "\" type=\"" + - getType() + "\" hiddenAfterString=\"" + - encode(getHiddenAfterString()) + "\"/>"); - out.write(buf.toString()); - } - - public void xmlSerializeRootOpen(Writer out) - throws IOException { - StringBuffer buf = new StringBuffer(100); - buf.append("<"); - buf.append(getClass().getName() + " "); - buf.append("hiddenBeforeString=\"" + - encode(getHiddenBeforeString()) + - "\" text=\"" + encode(getText()) + "\" type=\"" + - getType() + "\" hiddenAfterString=\"" + - encode(getHiddenAfterString()) + "\">\n"); - out.write(buf.toString()); - } - - public void xmlSerializeRootClose(Writer out) - throws IOException { - out.write("\n"); - } - - public void xmlSerialize(Writer out) throws IOException { - // print out this node and all siblings - for (AST node = this; - node != null; - node = node.getNextSibling()) { - if (node.getFirstChild() == null) { - // print guts (class name, attributes) - ((BaseAST)node).xmlSerializeNode(out); - } - else { - ((BaseAST)node).xmlSerializeRootOpen(out); - - // print children - ((BaseAST)node.getFirstChild()).xmlSerialize(out); - - // print end tag - ((BaseAST)node).xmlSerializeRootClose(out); - } - } - } - -} diff --git a/app/preproc/LineObject.java b/app/preproc/LineObject.java deleted file mode 100755 index ac6bde917..000000000 --- a/app/preproc/LineObject.java +++ /dev/null @@ -1,126 +0,0 @@ -package processing.app.preproc; - -class LineObject { - LineObject parent = null; - String source = ""; - int line = 1; - boolean enteringFile = false; - boolean returningToFile = false; - boolean systemHeader = false; - boolean treatAsC = false; - - public LineObject() - { - super(); - } - - public LineObject( LineObject lobj ) - { - parent = lobj.getParent(); - source = lobj.getSource(); - line = lobj.getLine(); - enteringFile = lobj.getEnteringFile(); - returningToFile = lobj.getReturningToFile(); - systemHeader = lobj.getSystemHeader(); - treatAsC = lobj.getTreatAsC(); - } - - public LineObject( String src) - { - source = src; - } - - public void setSource(String src) - { - source = src; - } - - public String getSource() - { - return source; - } - - public void setParent(LineObject par) - { - parent = par; - } - - public LineObject getParent() - { - return parent; - } - - public void setLine(int l) - { - line = l; - } - - public int getLine() - { - return line; - } - - public void newline() - { - line++; - } - - public void setEnteringFile(boolean v) - { - enteringFile = v; - } - - public boolean getEnteringFile() - { - return enteringFile; - } - - public void setReturningToFile(boolean v) - { - returningToFile = v; - } - - public boolean getReturningToFile() - { - return returningToFile; - } - - public void setSystemHeader(boolean v) - { - systemHeader = v; - } - - public boolean getSystemHeader() - { - return systemHeader; - } - - public void setTreatAsC(boolean v) - { - treatAsC = v; - } - - public boolean getTreatAsC() - { - return treatAsC; - } - - public String toString() { - StringBuffer ret; - ret = new StringBuffer("# " + line + " \"" + source + "\""); - if (enteringFile) { - ret.append(" 1"); - } - if (returningToFile) { - ret.append(" 2"); - } - if (systemHeader) { - ret.append(" 3"); - } - if (treatAsC) { - ret.append(" 4"); - } - return ret.toString(); - } -} - diff --git a/app/preproc/Makefile b/app/preproc/Makefile deleted file mode 100755 index 75d3d8848..000000000 --- a/app/preproc/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -classfiles = LineObject.class PreprocessorInfoChannel.class StdCParser.class StdCLexer.class WParser.class WLexer.class WTreeParser.class WEmitter.class -javafiles = CSymbolTable.java TNode.java TNodeFactory.java CToken.java LineObject.java PreprocessorInfoChannel.java StdCParser.java StdCLexer.java WParser.java WLexer.java WTreeParser.java WEmitter.java - - -all : $(javafiles) $(classfiles) - - - -clean : - - - -StdCParser.java StdCLexer.java : StdCParser.g - java -cp "..\\..\\build\\windows\\work\\lib\\antlr.jar" antlr.Tool StdCParser.g - - -WParser.java WLexer.java : WParser.g WParser.g - java -cp "..\\..\\build\\windows\\work\\lib\\antlr.jar" antlr.Tool -glib "StdCParser.g" WParser.g - - -WTreeParser.java : WTreeParser.g - java -cp "..\\..\\build\\windows\\work\\lib\\antlr.jar" antlr.Tool WTreeParser.g - - -WEmitter.java : WEmitter.g WTreeParser.g - java -cp "..\\..\\build\\windows\\work\\lib\\antlr.jar" antlr.Tool -glib "WTreeParser.g" WEmitter.g - - - -.SUFFIXES: .java .class - -.java.class : - ../../build/windows/work/jikes -cp "..\\..\\build\\windows\\work\\java\\lib\\rt.jar;..\\..\\build\\windows\\work\\lib\\mrj.jar;..\\..\\build\\windows\\work\\lib\\antlr.jar;." $< - - - diff --git a/app/preproc/PdePreprocessor.java b/app/preproc/PdePreprocessor.java index d20f17be1..669a73ee8 100755 --- a/app/preproc/PdePreprocessor.java +++ b/app/preproc/PdePreprocessor.java @@ -256,10 +256,10 @@ public class PdePreprocessor { // match those that will be highlighted in the PDE IDE // //System.out.println(program); - WLexer lexer = new WLexer(programReader); + // DAM:WTF? WLexer lexer = new WLexer(programReader); //lexer.setTokenObjectClass("antlr.CommonHiddenStreamToken"); - lexer.setTokenObjectClass("processing.app.preproc.CToken"); - lexer.initialize(); + // DAM:WTF? lexer.setTokenObjectClass("processing.app.preproc.CToken"); + // DAM:WTF? lexer.initialize(); // create the filter for hidden tokens and specify which tokens to // hide and which to copy to the hidden text @@ -281,13 +281,13 @@ public class PdePreprocessor { // create a parser and set what sort of AST should be generated // //PdeRecognizer parser = new PdeRecognizer(filter); - WParser parser = new WParser(lexer); + // DAM:WTF? WParser parser = new WParser(lexer); // use our extended AST class // //parser.setASTNodeClass("antlr.ExtendedCommonASTWithHiddenTokens"); - parser.setASTNodeType(TNode.class.getName()); - TNode.setTokenVocabulary("processing.app.preproc.WTokenTypes"); + // DAM:WTF? parser.setASTNodeType(TNode.class.getName()); + // DAM:WTF? TNode.setTokenVocabulary("processing.app.preproc.WTokenTypes"); // start parsing at the compilationUnit non-terminal // @@ -296,23 +296,23 @@ public class PdePreprocessor { // set up the AST for traversal by PdeEmitter // - ASTFactory factory = new ASTFactory(); - AST parserAST = parser.getAST(); - AST rootNode = factory.create(ROOT_ID, "AST ROOT"); - rootNode.setFirstChild(parserAST); + // DAM:WTF? ASTFactory factory = new ASTFactory(); + // DAM:WTF? AST parserAST = parser.getAST(); + // DAM:WTF? AST rootNode = factory.create(ROOT_ID, "AST ROOT"); + // DAM:WTF? rootNode.setFirstChild(parserAST); // unclear if this actually works, but it's worth a shot // //((CommonAST)parserAST).setVerboseStringConversion( // true, parser.getTokenNames()); // (made to use the static version because of jikes 1.22 warning) - CommonAST.setVerboseStringConversion(true, parser.getTokenNames()); + // DAM:WTF? CommonAST.setVerboseStringConversion(true, parser.getTokenNames()); // if this is an advanced program, the classname is already defined. // - if (programType == JAVA) { - name = getFirstClassName(parserAST); - } + // DAM:WTF? if (programType == JAVA) { + // DAM:WTF? name = getFirstClassName(parserAST); + // DAM:WTF? } // if 'null' was passed in for the name, but this isn't // a 'java' mode class, then there's a problem, so punt. @@ -321,7 +321,7 @@ public class PdePreprocessor { // output the code // - WEmitter emitter = new WEmitter(lexer.getPreprocessorInfoChannel()); + // DAM:WTF? WEmitter emitter = new WEmitter(lexer.getPreprocessorInfoChannel()); File streamFile = new File(buildPath, name + ".cpp"); PrintStream stream = new PrintStream(new FileOutputStream(streamFile)); @@ -329,8 +329,8 @@ public class PdePreprocessor { writeHeader(stream, name, prototypes); //added to write the pde code to the cpp file writeProgram(stream, name, program); - emitter.setASTNodeType(TNode.class.getName()); - emitter.setOut(stream); + // DAM:WTF? emitter.setASTNodeType(TNode.class.getName()); + // DAM:WTF? emitter.setOut(stream); //emitter.printDeclarations(rootNode); //emitter.print(rootNode); //emitter.translationUnit(parser.getAST()); @@ -340,7 +340,7 @@ public class PdePreprocessor { // if desired, serialize the parse tree to an XML file. can // be viewed usefully with Mozilla or IE - + /* DAM:WTF? if (Preferences.getBoolean("preproc.output_parse_tree")) { stream = new PrintStream(new FileOutputStream("parseTree.xml")); @@ -354,6 +354,7 @@ public class PdePreprocessor { stream.println(""); writer.close(); } + */ return name; } diff --git a/app/preproc/PreprocessorInfoChannel.java b/app/preproc/PreprocessorInfoChannel.java deleted file mode 100755 index 48f34853f..000000000 --- a/app/preproc/PreprocessorInfoChannel.java +++ /dev/null @@ -1,73 +0,0 @@ -package processing.app.preproc; - -import java.util.*; - -public class PreprocessorInfoChannel -{ - Hashtable lineLists = new Hashtable(); // indexed by Token number - int firstValidTokenNumber = 0; - int maxTokenNumber = 0; - - public void addLineForTokenNumber( Object line, Integer toknum ) - { - if ( lineLists.containsKey( toknum ) ) { - Vector lines = (Vector) lineLists.get( toknum ); - lines.addElement(line); - } - else { - Vector lines = new Vector(); - lines.addElement(line); - lineLists.put(toknum, lines); - if ( maxTokenNumber < toknum.intValue() ) { - maxTokenNumber = toknum.intValue(); - } - } - } - - public int getMaxTokenNumber() - { - return maxTokenNumber; - } - - public Vector extractLinesPrecedingTokenNumber( Integer toknum ) - { - Vector lines = new Vector(); - if (toknum == null) return lines; - for (int i = firstValidTokenNumber; i < toknum.intValue(); i++){ - Integer inti = new Integer(i); - if ( lineLists.containsKey( inti ) ) { - Vector tokenLineVector = (Vector) lineLists.get( inti ); - if ( tokenLineVector != null) { - Enumeration tokenLines = tokenLineVector.elements(); - while ( tokenLines.hasMoreElements() ) { - lines.addElement( tokenLines.nextElement() ); - } - lineLists.remove(inti); - } - } - } - firstValidTokenNumber = toknum.intValue(); - return lines; - } - - public String toString() - { - StringBuffer sb = new StringBuffer("PreprocessorInfoChannel:\n"); - for (int i = 0; i <= maxTokenNumber + 1; i++){ - Integer inti = new Integer(i); - if ( lineLists.containsKey( inti ) ) { - Vector tokenLineVector = (Vector) lineLists.get( inti ); - if ( tokenLineVector != null) { - Enumeration tokenLines = tokenLineVector.elements(); - while ( tokenLines.hasMoreElements() ) { - sb.append(inti + ":" + tokenLines.nextElement() + '\n'); - } - } - } - } - return sb.toString(); - } -} - - - diff --git a/app/preproc/STDCTokenTypes.java b/app/preproc/STDCTokenTypes.java deleted file mode 100644 index 112d6c4ce..000000000 --- a/app/preproc/STDCTokenTypes.java +++ /dev/null @@ -1,149 +0,0 @@ -// $ANTLR 2.7.2: "StdCParser.g" -> "StdCLexer.java"$ - -package processing.app.preproc; -import java.io.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; - -public interface STDCTokenTypes { - int EOF = 1; - int NULL_TREE_LOOKAHEAD = 3; - int LITERAL_typedef = 4; - int LITERAL_asm = 5; - int LITERAL_volatile = 6; - int LCURLY = 7; - int RCURLY = 8; - int SEMI = 9; - int LITERAL_struct = 10; - int LITERAL_union = 11; - int LITERAL_enum = 12; - int LITERAL_auto = 13; - int LITERAL_register = 14; - int LITERAL_extern = 15; - int LITERAL_static = 16; - int LITERAL_const = 17; - int LITERAL_void = 18; - int LITERAL_char = 19; - int LITERAL_short = 20; - int LITERAL_int = 21; - int LITERAL_long = 22; - int LITERAL_float = 23; - int LITERAL_double = 24; - int LITERAL_signed = 25; - int LITERAL_unsigned = 26; - int ID = 27; - int COMMA = 28; - int COLON = 29; - int ASSIGN = 30; - int STAR = 31; - int LPAREN = 32; - int RPAREN = 33; - int LBRACKET = 34; - int RBRACKET = 35; - int VARARGS = 36; - int LITERAL_while = 37; - int LITERAL_do = 38; - int LITERAL_for = 39; - int LITERAL_goto = 40; - int LITERAL_continue = 41; - int LITERAL_break = 42; - int LITERAL_return = 43; - int LITERAL_case = 44; - int LITERAL_default = 45; - int LITERAL_if = 46; - int LITERAL_else = 47; - int LITERAL_switch = 48; - int DIV_ASSIGN = 49; - int PLUS_ASSIGN = 50; - int MINUS_ASSIGN = 51; - int STAR_ASSIGN = 52; - int MOD_ASSIGN = 53; - int RSHIFT_ASSIGN = 54; - int LSHIFT_ASSIGN = 55; - int BAND_ASSIGN = 56; - int BOR_ASSIGN = 57; - int BXOR_ASSIGN = 58; - int QUESTION = 59; - int LOR = 60; - int LAND = 61; - int BOR = 62; - int BXOR = 63; - int BAND = 64; - int EQUAL = 65; - int NOT_EQUAL = 66; - int LT = 67; - int LTE = 68; - int GT = 69; - int GTE = 70; - int LSHIFT = 71; - int RSHIFT = 72; - int PLUS = 73; - int MINUS = 74; - int DIV = 75; - int MOD = 76; - int INC = 77; - int DEC = 78; - int LITERAL_sizeof = 79; - int BNOT = 80; - int LNOT = 81; - int PTR = 82; - int DOT = 83; - int CharLiteral = 84; - int StringLiteral = 85; - int IntOctalConst = 86; - int LongOctalConst = 87; - int UnsignedOctalConst = 88; - int IntIntConst = 89; - int LongIntConst = 90; - int UnsignedIntConst = 91; - int IntHexConst = 92; - int LongHexConst = 93; - int UnsignedHexConst = 94; - int FloatDoubleConst = 95; - int DoubleDoubleConst = 96; - int LongDoubleConst = 97; - int NTypedefName = 98; - int NInitDecl = 99; - int NDeclarator = 100; - int NStructDeclarator = 101; - int NDeclaration = 102; - int NCast = 103; - int NPointerGroup = 104; - int NExpressionGroup = 105; - int NFunctionCallArgs = 106; - int NNonemptyAbstractDeclarator = 107; - int NInitializer = 108; - int NStatementExpr = 109; - int NEmptyExpression = 110; - int NParameterTypeList = 111; - int NFunctionDef = 112; - int NCompoundStatement = 113; - int NParameterDeclaration = 114; - int NCommaExpr = 115; - int NUnaryExpr = 116; - int NLabel = 117; - int NPostfixExpr = 118; - int NRangeExpr = 119; - int NStringSeq = 120; - int NInitializerElementLabel = 121; - int NLcurlyInitializer = 122; - int NAsmAttribute = 123; - int NGnuAsmExpr = 124; - int NTypeMissing = 125; - int Vocabulary = 126; - int Whitespace = 127; - int Comment = 128; - int CPPComment = 129; - int PREPROC_DIRECTIVE = 130; - int Space = 131; - int LineDirective = 132; - int BadStringLiteral = 133; - int Escape = 134; - int Digit = 135; - int LongSuffix = 136; - int UnsignedSuffix = 137; - int FloatSuffix = 138; - int Exponent = 139; - int Number = 140; -} diff --git a/app/preproc/STDCTokenTypes.txt b/app/preproc/STDCTokenTypes.txt deleted file mode 100644 index 902834cd8..000000000 --- a/app/preproc/STDCTokenTypes.txt +++ /dev/null @@ -1,139 +0,0 @@ -// $ANTLR 2.7.2: StdCParser.g -> STDCTokenTypes.txt$ -STDC // output token vocab name -LITERAL_typedef="typedef"=4 -LITERAL_asm="asm"=5 -LITERAL_volatile="volatile"=6 -LCURLY=7 -RCURLY=8 -SEMI=9 -LITERAL_struct="struct"=10 -LITERAL_union="union"=11 -LITERAL_enum="enum"=12 -LITERAL_auto="auto"=13 -LITERAL_register="register"=14 -LITERAL_extern="extern"=15 -LITERAL_static="static"=16 -LITERAL_const="const"=17 -LITERAL_void="void"=18 -LITERAL_char="char"=19 -LITERAL_short="short"=20 -LITERAL_int="int"=21 -LITERAL_long="long"=22 -LITERAL_float="float"=23 -LITERAL_double="double"=24 -LITERAL_signed="signed"=25 -LITERAL_unsigned="unsigned"=26 -ID=27 -COMMA=28 -COLON=29 -ASSIGN=30 -STAR=31 -LPAREN=32 -RPAREN=33 -LBRACKET=34 -RBRACKET=35 -VARARGS=36 -LITERAL_while="while"=37 -LITERAL_do="do"=38 -LITERAL_for="for"=39 -LITERAL_goto="goto"=40 -LITERAL_continue="continue"=41 -LITERAL_break="break"=42 -LITERAL_return="return"=43 -LITERAL_case="case"=44 -LITERAL_default="default"=45 -LITERAL_if="if"=46 -LITERAL_else="else"=47 -LITERAL_switch="switch"=48 -DIV_ASSIGN=49 -PLUS_ASSIGN=50 -MINUS_ASSIGN=51 -STAR_ASSIGN=52 -MOD_ASSIGN=53 -RSHIFT_ASSIGN=54 -LSHIFT_ASSIGN=55 -BAND_ASSIGN=56 -BOR_ASSIGN=57 -BXOR_ASSIGN=58 -QUESTION=59 -LOR=60 -LAND=61 -BOR=62 -BXOR=63 -BAND=64 -EQUAL=65 -NOT_EQUAL=66 -LT=67 -LTE=68 -GT=69 -GTE=70 -LSHIFT=71 -RSHIFT=72 -PLUS=73 -MINUS=74 -DIV=75 -MOD=76 -INC=77 -DEC=78 -LITERAL_sizeof="sizeof"=79 -BNOT=80 -LNOT=81 -PTR=82 -DOT=83 -CharLiteral=84 -StringLiteral=85 -IntOctalConst=86 -LongOctalConst=87 -UnsignedOctalConst=88 -IntIntConst=89 -LongIntConst=90 -UnsignedIntConst=91 -IntHexConst=92 -LongHexConst=93 -UnsignedHexConst=94 -FloatDoubleConst=95 -DoubleDoubleConst=96 -LongDoubleConst=97 -NTypedefName=98 -NInitDecl=99 -NDeclarator=100 -NStructDeclarator=101 -NDeclaration=102 -NCast=103 -NPointerGroup=104 -NExpressionGroup=105 -NFunctionCallArgs=106 -NNonemptyAbstractDeclarator=107 -NInitializer=108 -NStatementExpr=109 -NEmptyExpression=110 -NParameterTypeList=111 -NFunctionDef=112 -NCompoundStatement=113 -NParameterDeclaration=114 -NCommaExpr=115 -NUnaryExpr=116 -NLabel=117 -NPostfixExpr=118 -NRangeExpr=119 -NStringSeq=120 -NInitializerElementLabel=121 -NLcurlyInitializer=122 -NAsmAttribute=123 -NGnuAsmExpr=124 -NTypeMissing=125 -Vocabulary=126 -Whitespace=127 -Comment=128 -CPPComment=129 -PREPROC_DIRECTIVE("a line directive")=130 -Space=131 -LineDirective=132 -BadStringLiteral=133 -Escape=134 -Digit=135 -LongSuffix=136 -UnsignedSuffix=137 -FloatSuffix=138 -Exponent=139 -Number=140 diff --git a/app/preproc/StdCLexer.java b/app/preproc/StdCLexer.java deleted file mode 100644 index ed3c38b80..000000000 --- a/app/preproc/StdCLexer.java +++ /dev/null @@ -1,2745 +0,0 @@ -// $ANTLR 2.7.2: "StdCParser.g" -> "StdCLexer.java"$ - -package processing.app.preproc; -import java.io.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; - -import java.io.InputStream; -import antlr.TokenStreamException; -import antlr.TokenStreamIOException; -import antlr.TokenStreamRecognitionException; -import antlr.CharStreamException; -import antlr.CharStreamIOException; -import antlr.ANTLRException; -import java.io.Reader; -import java.util.Hashtable; -import antlr.CharScanner; -import antlr.InputBuffer; -import antlr.ByteBuffer; -import antlr.CharBuffer; -import antlr.Token; -import antlr.CommonToken; -import antlr.RecognitionException; -import antlr.NoViableAltForCharException; -import antlr.MismatchedCharException; -import antlr.TokenStream; -import antlr.ANTLRHashString; -import antlr.LexerSharedInputState; -import antlr.collections.impl.BitSet; -import antlr.SemanticException; - -// import CToken; - import java.io.*; -// import LineObject; - import antlr.*; - -public class StdCLexer extends antlr.CharScanner implements STDCTokenTypes, TokenStream - { - - LineObject lineObject = new LineObject(); - String originalSource = ""; - PreprocessorInfoChannel preprocessorInfoChannel = new PreprocessorInfoChannel(); - int tokenNumber = 0; - boolean countingTokens = true; - int deferredLineCount = 0; - - public void setCountingTokens(boolean ct) - { - countingTokens = ct; - if ( countingTokens ) { - tokenNumber = 0; - } - else { - tokenNumber = 1; - } - } - - public void setOriginalSource(String src) - { - originalSource = src; - lineObject.setSource(src); - } - public void setSource(String src) - { - lineObject.setSource(src); - } - - public PreprocessorInfoChannel getPreprocessorInfoChannel() - { - return preprocessorInfoChannel; - } - - public void setPreprocessingDirective(String pre) - { - preprocessorInfoChannel.addLineForTokenNumber( pre, new Integer(tokenNumber) ); - } - - protected Token makeToken(int t) - { - if ( t != Token.SKIP && countingTokens) { - tokenNumber++; - } - CToken tok = (CToken) super.makeToken(t); - tok.setLine(lineObject.line); - tok.setSource(lineObject.source); - tok.setTokenNumber(tokenNumber); - - lineObject.line += deferredLineCount; - deferredLineCount = 0; - return tok; - } - - public void deferredNewline() { - deferredLineCount++; - } - - public void newline() { - lineObject.newline(); - } - - - - - - -public StdCLexer(InputStream in) { - this(new ByteBuffer(in)); -} -public StdCLexer(Reader in) { - this(new CharBuffer(in)); -} -public StdCLexer(InputBuffer ib) { - this(new LexerSharedInputState(ib)); -} -public StdCLexer(LexerSharedInputState state) { - super(state); - caseSensitiveLiterals = true; - setCaseSensitive(true); - literals = new Hashtable(); - literals.put(new ANTLRHashString("switch", this), new Integer(48)); - literals.put(new ANTLRHashString("case", this), new Integer(44)); - literals.put(new ANTLRHashString("for", this), new Integer(39)); - literals.put(new ANTLRHashString("register", this), new Integer(14)); - literals.put(new ANTLRHashString("sizeof", this), new Integer(79)); - literals.put(new ANTLRHashString("auto", this), new Integer(13)); - literals.put(new ANTLRHashString("void", this), new Integer(18)); - literals.put(new ANTLRHashString("float", this), new Integer(23)); - literals.put(new ANTLRHashString("continue", this), new Integer(41)); - literals.put(new ANTLRHashString("long", this), new Integer(22)); - literals.put(new ANTLRHashString("do", this), new Integer(38)); - literals.put(new ANTLRHashString("typedef", this), new Integer(4)); - literals.put(new ANTLRHashString("short", this), new Integer(20)); - literals.put(new ANTLRHashString("signed", this), new Integer(25)); - literals.put(new ANTLRHashString("enum", this), new Integer(12)); - literals.put(new ANTLRHashString("asm", this), new Integer(5)); - literals.put(new ANTLRHashString("static", this), new Integer(16)); - literals.put(new ANTLRHashString("char", this), new Integer(19)); - literals.put(new ANTLRHashString("union", this), new Integer(11)); - literals.put(new ANTLRHashString("while", this), new Integer(37)); - literals.put(new ANTLRHashString("const", this), new Integer(17)); - literals.put(new ANTLRHashString("break", this), new Integer(42)); - literals.put(new ANTLRHashString("extern", this), new Integer(15)); - literals.put(new ANTLRHashString("return", this), new Integer(43)); - literals.put(new ANTLRHashString("if", this), new Integer(46)); - literals.put(new ANTLRHashString("int", this), new Integer(21)); - literals.put(new ANTLRHashString("double", this), new Integer(24)); - literals.put(new ANTLRHashString("volatile", this), new Integer(6)); - literals.put(new ANTLRHashString("default", this), new Integer(45)); - literals.put(new ANTLRHashString("unsigned", this), new Integer(26)); - literals.put(new ANTLRHashString("struct", this), new Integer(10)); - literals.put(new ANTLRHashString("else", this), new Integer(47)); - literals.put(new ANTLRHashString("goto", this), new Integer(40)); -} - -public Token nextToken() throws TokenStreamException { - Token theRetToken=null; -tryAgain: - for (;;) { - Token _token = null; - int _ttype = Token.INVALID_TYPE; - resetText(); - try { // for char stream error handling - try { // for lexical error handling - switch ( LA(1)) { - case ':': - { - mCOLON(true); - theRetToken=_returnToken; - break; - } - case ',': - { - mCOMMA(true); - theRetToken=_returnToken; - break; - } - case '?': - { - mQUESTION(true); - theRetToken=_returnToken; - break; - } - case ';': - { - mSEMI(true); - theRetToken=_returnToken; - break; - } - case '(': - { - mLPAREN(true); - theRetToken=_returnToken; - break; - } - case ')': - { - mRPAREN(true); - theRetToken=_returnToken; - break; - } - case '[': - { - mLBRACKET(true); - theRetToken=_returnToken; - break; - } - case ']': - { - mRBRACKET(true); - theRetToken=_returnToken; - break; - } - case '{': - { - mLCURLY(true); - theRetToken=_returnToken; - break; - } - case '}': - { - mRCURLY(true); - theRetToken=_returnToken; - break; - } - case '~': - { - mBNOT(true); - theRetToken=_returnToken; - break; - } - case '#': - { - mPREPROC_DIRECTIVE(true); - theRetToken=_returnToken; - break; - } - case '.': case '0': case '1': case '2': - case '3': case '4': case '5': case '6': - case '7': case '8': case '9': - { - mNumber(true); - theRetToken=_returnToken; - break; - } - case '"': - { - mStringLiteral(true); - theRetToken=_returnToken; - break; - } - case 'A': case 'B': case 'C': case 'D': - case 'E': case 'F': case 'G': case 'H': - case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': - case 'Q': case 'R': case 'S': case 'T': - case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': case '_': case 'a': - case 'b': case 'c': case 'd': case 'e': - case 'f': case 'g': case 'h': case 'i': - case 'j': case 'k': case 'l': case 'm': - case 'n': case 'o': case 'p': case 'q': - case 'r': case 's': case 't': case 'u': - case 'v': case 'w': case 'x': case 'y': - case 'z': - { - mID(true); - theRetToken=_returnToken; - break; - } - case '\'': - { - mCharLiteral(true); - theRetToken=_returnToken; - break; - } - default: - if ((LA(1)=='>') && (LA(2)=='>') && (LA(3)=='=')) { - mRSHIFT_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='<') && (LA(2)=='<') && (LA(3)=='=')) { - mLSHIFT_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='-') && (LA(2)=='>')) { - mPTR(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='=') && (LA(2)=='=')) { - mEQUAL(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='!') && (LA(2)=='=')) { - mNOT_EQUAL(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='<') && (LA(2)=='=')) { - mLTE(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='>') && (LA(2)=='=')) { - mGTE(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='/') && (LA(2)=='=')) { - mDIV_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='+') && (LA(2)=='=')) { - mPLUS_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='+') && (LA(2)=='+')) { - mINC(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='-') && (LA(2)=='=')) { - mMINUS_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='-') && (LA(2)=='-')) { - mDEC(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='*') && (LA(2)=='=')) { - mSTAR_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='%') && (LA(2)=='=')) { - mMOD_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='>') && (LA(2)=='>') && (true)) { - mRSHIFT(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='<') && (LA(2)=='<') && (true)) { - mLSHIFT(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='&') && (LA(2)=='&')) { - mLAND(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='|') && (LA(2)=='|')) { - mLOR(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='&') && (LA(2)=='=')) { - mBAND_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='|') && (LA(2)=='=')) { - mBOR_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='^') && (LA(2)=='=')) { - mBXOR_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='/') && (LA(2)=='*')) { - mComment(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='/') && (LA(2)=='/')) { - mCPPComment(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='=') && (true)) { - mASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='<') && (true)) { - mLT(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='>') && (true)) { - mGT(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='/') && (true)) { - mDIV(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='+') && (true)) { - mPLUS(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='-') && (true)) { - mMINUS(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='*') && (true)) { - mSTAR(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='%') && (true)) { - mMOD(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='!') && (true)) { - mLNOT(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='&') && (true)) { - mBAND(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='|') && (true)) { - mBOR(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='^') && (true)) { - mBXOR(true); - theRetToken=_returnToken; - } - else if ((_tokenSet_0.member(LA(1)))) { - mWhitespace(true); - theRetToken=_returnToken; - } - else { - if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);} - else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - } - if ( _returnToken==null ) continue tryAgain; // found SKIP token - _ttype = _returnToken.getType(); - _returnToken.setType(_ttype); - return _returnToken; - } - catch (RecognitionException e) { - throw new TokenStreamRecognitionException(e); - } - } - catch (CharStreamException cse) { - if ( cse instanceof CharStreamIOException ) { - throw new TokenStreamIOException(((CharStreamIOException)cse).io); - } - else { - throw new TokenStreamException(cse.getMessage()); - } - } - } -} - - protected final void mVocabulary(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Vocabulary; - int _saveIndex; - - matchRange('\3','\377'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = ASSIGN; - int _saveIndex; - - match('='); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mCOLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = COLON; - int _saveIndex; - - match(':'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = COMMA; - int _saveIndex; - - match(','); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mQUESTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = QUESTION; - int _saveIndex; - - match('?'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = SEMI; - int _saveIndex; - - match(';'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mPTR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = PTR; - int _saveIndex; - - match("->"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mDOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = DOT; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mVARARGS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = VARARGS; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LPAREN; - int _saveIndex; - - match('('); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = RPAREN; - int _saveIndex; - - match(')'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLBRACKET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LBRACKET; - int _saveIndex; - - match('['); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mRBRACKET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = RBRACKET; - int _saveIndex; - - match(']'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LCURLY; - int _saveIndex; - - match('{'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mRCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = RCURLY; - int _saveIndex; - - match('}'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mEQUAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = EQUAL; - int _saveIndex; - - match("=="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mNOT_EQUAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = NOT_EQUAL; - int _saveIndex; - - match("!="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LTE; - int _saveIndex; - - match("<="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LT; - int _saveIndex; - - match("<"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mGTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = GTE; - int _saveIndex; - - match(">="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mGT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = GT; - int _saveIndex; - - match(">"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mDIV(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = DIV; - int _saveIndex; - - match('/'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mDIV_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = DIV_ASSIGN; - int _saveIndex; - - match("/="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mPLUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = PLUS; - int _saveIndex; - - match('+'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mPLUS_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = PLUS_ASSIGN; - int _saveIndex; - - match("+="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mINC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = INC; - int _saveIndex; - - match("++"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mMINUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = MINUS; - int _saveIndex; - - match('-'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mMINUS_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = MINUS_ASSIGN; - int _saveIndex; - - match("-="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mDEC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = DEC; - int _saveIndex; - - match("--"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mSTAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = STAR; - int _saveIndex; - - match('*'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mSTAR_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = STAR_ASSIGN; - int _saveIndex; - - match("*="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mMOD(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = MOD; - int _saveIndex; - - match('%'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mMOD_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = MOD_ASSIGN; - int _saveIndex; - - match("%="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mRSHIFT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = RSHIFT; - int _saveIndex; - - match(">>"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mRSHIFT_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = RSHIFT_ASSIGN; - int _saveIndex; - - match(">>="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLSHIFT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LSHIFT; - int _saveIndex; - - match("<<"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLSHIFT_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LSHIFT_ASSIGN; - int _saveIndex; - - match("<<="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLAND(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LAND; - int _saveIndex; - - match("&&"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLNOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LNOT; - int _saveIndex; - - match('!'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LOR; - int _saveIndex; - - match("||"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mBAND(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BAND; - int _saveIndex; - - match('&'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mBAND_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BAND_ASSIGN; - int _saveIndex; - - match("&="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mBNOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BNOT; - int _saveIndex; - - match('~'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mBOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BOR; - int _saveIndex; - - match('|'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mBOR_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BOR_ASSIGN; - int _saveIndex; - - match("|="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mBXOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BXOR; - int _saveIndex; - - match('^'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mBXOR_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BXOR_ASSIGN; - int _saveIndex; - - match("^="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mWhitespace(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Whitespace; - int _saveIndex; - - { - if ((LA(1)=='\r') && (LA(2)=='\n')) { - match("\r\n"); - if ( inputState.guessing==0 ) { - newline(); - } - } - else if ((_tokenSet_1.member(LA(1)))) { - { - switch ( LA(1)) { - case '\u0003': case '\u0004': case '\u0005': case '\u0006': - case '\u0007': case '\u0008': - { - matchRange('\003','\010'); - break; - } - case '\t': - { - match('\t'); - break; - } - case '\u000b': - { - match('\013'); - break; - } - case '\u000c': - { - match('\f'); - break; - } - case '\u000e': case '\u000f': case '\u0010': case '\u0011': - case '\u0012': case '\u0013': case '\u0014': case '\u0015': - case '\u0016': case '\u0017': case '\u0018': case '\u0019': - case '\u001a': case '\u001b': case '\u001c': case '\u001d': - case '\u001e': case '\u001f': - { - matchRange('\016','\037'); - break; - } - case ' ': - { - match(' '); - break; - } - default: - if (((LA(1) >= '\u007f' && LA(1) <= '\u00ff'))) { - matchRange('\177','\377'); - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - } - else if ((LA(1)=='\n'||LA(1)=='\r') && (true)) { - { - switch ( LA(1)) { - case '\n': - { - match('\n'); - break; - } - case '\r': - { - match('\r'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - if ( inputState.guessing==0 ) { - newline(); - } - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - if ( inputState.guessing==0 ) { - _ttype = Token.SKIP; - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mComment(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Comment; - int _saveIndex; - - match("/*"); - { - _loop269: - do { - if (((LA(1)=='*') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff')))&&( LA(2) != '/' )) { - match('*'); - } - else if ((LA(1)=='\r') && (LA(2)=='\n') && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { - match("\r\n"); - if ( inputState.guessing==0 ) { - deferredNewline(); - } - } - else if ((LA(1)=='\n'||LA(1)=='\r') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { - { - switch ( LA(1)) { - case '\r': - { - match('\r'); - break; - } - case '\n': - { - match('\n'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - if ( inputState.guessing==0 ) { - deferredNewline(); - } - } - else if ((_tokenSet_2.member(LA(1)))) { - { - match(_tokenSet_2); - } - } - else { - break _loop269; - } - - } while (true); - } - match("*/"); - if ( inputState.guessing==0 ) { - _ttype = Token.SKIP; - - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mCPPComment(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = CPPComment; - int _saveIndex; - - match("//"); - { - _loop273: - do { - if ((_tokenSet_3.member(LA(1)))) { - { - match(_tokenSet_3); - } - } - else { - break _loop273; - } - - } while (true); - } - if ( inputState.guessing==0 ) { - - _ttype = Token.SKIP; - - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mPREPROC_DIRECTIVE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = PREPROC_DIRECTIVE; - int _saveIndex; - - match('#'); - { - boolean synPredMatched280 = false; - if (((_tokenSet_4.member(LA(1))) && (_tokenSet_5.member(LA(2))) && (_tokenSet_6.member(LA(3))))) { - int _m280 = mark(); - synPredMatched280 = true; - inputState.guessing++; - try { - { - switch ( LA(1)) { - case 'l': - { - match("line"); - break; - } - case '\t': case '\u000c': case ' ': - { - { - { - int _cnt279=0; - _loop279: - do { - switch ( LA(1)) { - case ' ': - { - match(' '); - break; - } - case '\t': - { - match('\t'); - break; - } - case '\u000c': - { - match('\014'); - break; - } - default: - { - if ( _cnt279>=1 ) { break _loop279; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - } - _cnt279++; - } while (true); - } - matchRange('0','9'); - } - break; - } - default: - { - } - } - } - } - catch (RecognitionException pe) { - synPredMatched280 = false; - } - rewind(_m280); - inputState.guessing--; - } - if ( synPredMatched280 ) { - mLineDirective(false); - } - else { - { - _loop282: - do { - if ((_tokenSet_3.member(LA(1)))) { - matchNot('\n'); - } - else { - break _loop282; - } - - } while (true); - } - if ( inputState.guessing==0 ) { - setPreprocessingDirective(getText()); - } - } - - } - if ( inputState.guessing==0 ) { - - _ttype = Token.SKIP; - - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mLineDirective(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LineDirective; - int _saveIndex; - Token n=null; - Token fn=null; - Token fi=null; - - boolean oldCountingTokens = countingTokens; - countingTokens = false; - - - if ( inputState.guessing==0 ) { - - lineObject = new LineObject(); - deferredLineCount = 0; - - } - { - switch ( LA(1)) { - case 'l': - { - match("line"); - break; - } - case '\t': case '\u000c': case ' ': - { - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - { - int _cnt288=0; - _loop288: - do { - if ((LA(1)=='\t'||LA(1)=='\u000c'||LA(1)==' ')) { - mSpace(false); - } - else { - if ( _cnt288>=1 ) { break _loop288; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt288++; - } while (true); - } - mNumber(true); - n=_returnToken; - if ( inputState.guessing==0 ) { - lineObject.setLine(Integer.parseInt(n.getText())); - } - { - int _cnt290=0; - _loop290: - do { - if ((LA(1)=='\t'||LA(1)=='\u000c'||LA(1)==' ') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mSpace(false); - } - else { - if ( _cnt290>=1 ) { break _loop290; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt290++; - } while (true); - } - { - if ((LA(1)=='"') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { - mStringLiteral(true); - fn=_returnToken; - if ( inputState.guessing==0 ) { - try { - lineObject.setSource(fn.getText().substring(1,fn.getText().length()-1)); - } - catch (StringIndexOutOfBoundsException e) { /*not possible*/ } - - } - } - else if ((_tokenSet_7.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mID(true); - fi=_returnToken; - if ( inputState.guessing==0 ) { - lineObject.setSource(fi.getText()); - } - } - else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - { - _loop293: - do { - if ((LA(1)=='\t'||LA(1)=='\u000c'||LA(1)==' ') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mSpace(false); - } - else { - break _loop293; - } - - } while (true); - } - { - if ((LA(1)=='1') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - match("1"); - if ( inputState.guessing==0 ) { - lineObject.setEnteringFile(true); - } - } - else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - { - _loop296: - do { - if ((LA(1)=='\t'||LA(1)=='\u000c'||LA(1)==' ') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mSpace(false); - } - else { - break _loop296; - } - - } while (true); - } - { - if ((LA(1)=='2') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - match("2"); - if ( inputState.guessing==0 ) { - lineObject.setReturningToFile(true); - } - } - else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - { - _loop299: - do { - if ((LA(1)=='\t'||LA(1)=='\u000c'||LA(1)==' ') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mSpace(false); - } - else { - break _loop299; - } - - } while (true); - } - { - if ((LA(1)=='3') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - match("3"); - if ( inputState.guessing==0 ) { - lineObject.setSystemHeader(true); - } - } - else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - { - _loop302: - do { - if ((LA(1)=='\t'||LA(1)=='\u000c'||LA(1)==' ') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mSpace(false); - } - else { - break _loop302; - } - - } while (true); - } - { - if ((LA(1)=='4') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - match("4"); - if ( inputState.guessing==0 ) { - lineObject.setTreatAsC(true); - } - } - else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - { - _loop306: - do { - if ((_tokenSet_8.member(LA(1)))) { - { - match(_tokenSet_8); - } - } - else { - break _loop306; - } - - } while (true); - } - { - if ((LA(1)=='\r') && (LA(2)=='\n')) { - match("\r\n"); - } - else if ((LA(1)=='\r') && (true)) { - match("\r"); - } - else if ((LA(1)=='\n')) { - match("\n"); - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - if ( inputState.guessing==0 ) { - - preprocessorInfoChannel.addLineForTokenNumber(new LineObject(lineObject), new Integer(tokenNumber)); - countingTokens = oldCountingTokens; - - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mSpace(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Space; - int _saveIndex; - - { - switch ( LA(1)) { - case ' ': - { - match(' '); - break; - } - case '\t': - { - match('\t'); - break; - } - case '\u000c': - { - match('\014'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mNumber(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Number; - int _saveIndex; - - boolean synPredMatched352 = false; - if ((((LA(1) >= '0' && LA(1) <= '9')) && (_tokenSet_9.member(LA(2))) && (true))) { - int _m352 = mark(); - synPredMatched352 = true; - inputState.guessing++; - try { - { - { - int _cnt350=0; - _loop350: - do { - if (((LA(1) >= '0' && LA(1) <= '9'))) { - mDigit(false); - } - else { - if ( _cnt350>=1 ) { break _loop350; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt350++; - } while (true); - } - { - switch ( LA(1)) { - case '.': - { - match('.'); - break; - } - case 'e': - { - match('e'); - break; - } - case 'E': - { - match('E'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - } - } - catch (RecognitionException pe) { - synPredMatched352 = false; - } - rewind(_m352); - inputState.guessing--; - } - if ( synPredMatched352 ) { - { - int _cnt354=0; - _loop354: - do { - if (((LA(1) >= '0' && LA(1) <= '9'))) { - mDigit(false); - } - else { - if ( _cnt354>=1 ) { break _loop354; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt354++; - } while (true); - } - { - switch ( LA(1)) { - case '.': - { - match('.'); - { - _loop357: - do { - if (((LA(1) >= '0' && LA(1) <= '9'))) { - mDigit(false); - } - else { - break _loop357; - } - - } while (true); - } - { - if ((LA(1)=='E'||LA(1)=='e')) { - mExponent(false); - } - else { - } - - } - break; - } - case 'E': case 'e': - { - mExponent(false); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - if ( inputState.guessing==0 ) { - _ttype = DoubleDoubleConst; - } - { - switch ( LA(1)) { - case 'F': case 'f': - { - mFloatSuffix(false); - if ( inputState.guessing==0 ) { - _ttype = FloatDoubleConst; - } - break; - } - case 'L': case 'l': - { - mLongSuffix(false); - if ( inputState.guessing==0 ) { - _ttype = LongDoubleConst; - } - break; - } - default: - { - } - } - } - } - else { - boolean synPredMatched361 = false; - if (((LA(1)=='.') && (LA(2)=='.'))) { - int _m361 = mark(); - synPredMatched361 = true; - inputState.guessing++; - try { - { - match("..."); - } - } - catch (RecognitionException pe) { - synPredMatched361 = false; - } - rewind(_m361); - inputState.guessing--; - } - if ( synPredMatched361 ) { - match("..."); - if ( inputState.guessing==0 ) { - _ttype = VARARGS; - } - } - else if ((LA(1)=='0') && (LA(2)=='X'||LA(2)=='x')) { - match('0'); - { - switch ( LA(1)) { - case 'x': - { - match('x'); - break; - } - case 'X': - { - match('X'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - { - int _cnt375=0; - _loop375: - do { - switch ( LA(1)) { - case 'a': case 'b': case 'c': case 'd': - case 'e': case 'f': - { - matchRange('a','f'); - break; - } - case 'A': case 'B': case 'C': case 'D': - case 'E': case 'F': - { - matchRange('A','F'); - break; - } - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - case '8': case '9': - { - mDigit(false); - break; - } - default: - { - if ( _cnt375>=1 ) { break _loop375; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - } - _cnt375++; - } while (true); - } - if ( inputState.guessing==0 ) { - _ttype = IntHexConst; - } - { - switch ( LA(1)) { - case 'L': case 'l': - { - mLongSuffix(false); - if ( inputState.guessing==0 ) { - _ttype = LongHexConst; - } - break; - } - case 'U': case 'u': - { - mUnsignedSuffix(false); - if ( inputState.guessing==0 ) { - _ttype = UnsignedHexConst; - } - break; - } - default: - { - } - } - } - } - else if ((LA(1)=='.') && (true)) { - match('.'); - if ( inputState.guessing==0 ) { - _ttype = DOT; - } - { - if (((LA(1) >= '0' && LA(1) <= '9'))) { - { - int _cnt364=0; - _loop364: - do { - if (((LA(1) >= '0' && LA(1) <= '9'))) { - mDigit(false); - } - else { - if ( _cnt364>=1 ) { break _loop364; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt364++; - } while (true); - } - { - if ((LA(1)=='E'||LA(1)=='e')) { - mExponent(false); - } - else { - } - - } - if ( inputState.guessing==0 ) { - _ttype = DoubleDoubleConst; - } - { - switch ( LA(1)) { - case 'F': case 'f': - { - mFloatSuffix(false); - if ( inputState.guessing==0 ) { - _ttype = FloatDoubleConst; - } - break; - } - case 'L': case 'l': - { - mLongSuffix(false); - if ( inputState.guessing==0 ) { - _ttype = LongDoubleConst; - } - break; - } - default: - { - } - } - } - } - else { - } - - } - } - else if ((LA(1)=='0') && (true) && (true)) { - match('0'); - { - _loop368: - do { - if (((LA(1) >= '0' && LA(1) <= '7'))) { - matchRange('0','7'); - } - else { - break _loop368; - } - - } while (true); - } - if ( inputState.guessing==0 ) { - _ttype = IntOctalConst; - } - { - switch ( LA(1)) { - case 'L': case 'l': - { - mLongSuffix(false); - if ( inputState.guessing==0 ) { - _ttype = LongOctalConst; - } - break; - } - case 'U': case 'u': - { - mUnsignedSuffix(false); - if ( inputState.guessing==0 ) { - _ttype = UnsignedOctalConst; - } - break; - } - default: - { - } - } - } - } - else if (((LA(1) >= '1' && LA(1) <= '9')) && (true) && (true)) { - matchRange('1','9'); - { - _loop371: - do { - if (((LA(1) >= '0' && LA(1) <= '9'))) { - mDigit(false); - } - else { - break _loop371; - } - - } while (true); - } - if ( inputState.guessing==0 ) { - _ttype = IntIntConst; - } - { - switch ( LA(1)) { - case 'L': case 'l': - { - mLongSuffix(false); - if ( inputState.guessing==0 ) { - _ttype = LongIntConst; - } - break; - } - case 'U': case 'u': - { - mUnsignedSuffix(false); - if ( inputState.guessing==0 ) { - _ttype = UnsignedIntConst; - } - break; - } - default: - { - } - } - } - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mStringLiteral(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = StringLiteral; - int _saveIndex; - - match('"'); - { - _loop315: - do { - if ((LA(1)=='\\') && (_tokenSet_10.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { - mEscape(false); - } - else if ((LA(1)=='\n'||LA(1)=='\r'||LA(1)=='\\') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - { - switch ( LA(1)) { - case '\r': - { - match('\r'); - if ( inputState.guessing==0 ) { - deferredNewline(); - } - break; - } - case '\n': - { - match('\n'); - if ( inputState.guessing==0 ) { - - deferredNewline(); - _ttype = BadStringLiteral; - - } - break; - } - case '\\': - { - match('\\'); - match('\n'); - if ( inputState.guessing==0 ) { - - deferredNewline(); - - } - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - } - else if ((_tokenSet_11.member(LA(1)))) { - { - match(_tokenSet_11); - } - } - else { - break _loop315; - } - - } while (true); - } - match('"'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = ID; - int _saveIndex; - - { - switch ( LA(1)) { - case 'a': case 'b': case 'c': case 'd': - case 'e': case 'f': case 'g': case 'h': - case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': - case 'q': case 'r': case 's': case 't': - case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - { - matchRange('a','z'); - break; - } - case 'A': case 'B': case 'C': case 'D': - case 'E': case 'F': case 'G': case 'H': - case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': - case 'Q': case 'R': case 'S': case 'T': - case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - { - matchRange('A','Z'); - break; - } - case '_': - { - match('_'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - { - _loop380: - do { - if (((LA(1) >= 'a' && LA(1) <= 'z')) && (true) && (true)) { - matchRange('a','z'); - } - else if (((LA(1) >= 'A' && LA(1) <= 'Z')) && (true) && (true)) { - matchRange('A','Z'); - } - else if ((LA(1)=='_') && (true) && (true)) { - match('_'); - } - else if (((LA(1) >= '0' && LA(1) <= '9')) && (true) && (true)) { - matchRange('0','9'); - } - else { - break _loop380; - } - - } while (true); - } - _ttype = testLiteralsTable(_ttype); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mCharLiteral(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = CharLiteral; - int _saveIndex; - - match('\''); - { - if ((LA(1)=='\\') && (_tokenSet_10.member(LA(2))) && (_tokenSet_12.member(LA(3)))) { - mEscape(false); - } - else if ((_tokenSet_13.member(LA(1))) && (LA(2)=='\'') && (true)) { - { - match(_tokenSet_13); - } - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - match('\''); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mEscape(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Escape; - int _saveIndex; - - match('\\'); - { - switch ( LA(1)) { - case 'a': - { - match('a'); - break; - } - case 'b': - { - match('b'); - break; - } - case 'f': - { - match('f'); - break; - } - case 'n': - { - match('n'); - break; - } - case 'r': - { - match('r'); - break; - } - case 't': - { - match('t'); - break; - } - case 'v': - { - match('v'); - break; - } - case '"': - { - match('"'); - break; - } - case '\'': - { - match('\''); - break; - } - case '\\': - { - match('\\'); - break; - } - case '?': - { - match('?'); - break; - } - case '0': case '1': case '2': case '3': - { - { - matchRange('0','3'); - } - { - if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mDigit(false); - { - if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mDigit(false); - } - else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - } - else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - break; - } - case '4': case '5': case '6': case '7': - { - { - matchRange('4','7'); - } - { - if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mDigit(false); - } - else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - break; - } - case 'x': - { - match('x'); - { - int _cnt325=0; - _loop325: - do { - if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mDigit(false); - } - else if (((LA(1) >= 'a' && LA(1) <= 'f')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - matchRange('a','f'); - } - else if (((LA(1) >= 'A' && LA(1) <= 'F')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - matchRange('A','F'); - } - else { - if ( _cnt325>=1 ) { break _loop325; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt325++; - } while (true); - } - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mBadStringLiteral(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BadStringLiteral; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mDigit(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Digit; - int _saveIndex; - - matchRange('0','9'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mLongSuffix(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LongSuffix; - int _saveIndex; - - switch ( LA(1)) { - case 'l': - { - match('l'); - break; - } - case 'L': - { - match('L'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mUnsignedSuffix(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = UnsignedSuffix; - int _saveIndex; - - switch ( LA(1)) { - case 'u': - { - match('u'); - break; - } - case 'U': - { - match('U'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mFloatSuffix(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = FloatSuffix; - int _saveIndex; - - switch ( LA(1)) { - case 'f': - { - match('f'); - break; - } - case 'F': - { - match('F'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mExponent(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Exponent; - int _saveIndex; - - { - switch ( LA(1)) { - case 'e': - { - match('e'); - break; - } - case 'E': - { - match('E'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - { - switch ( LA(1)) { - case '+': - { - match('+'); - break; - } - case '-': - { - match('-'); - break; - } - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - case '8': case '9': - { - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - { - int _cnt334=0; - _loop334: - do { - if (((LA(1) >= '0' && LA(1) <= '9'))) { - mDigit(false); - } - else { - if ( _cnt334>=1 ) { break _loop334; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt334++; - } while (true); - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mDoubleDoubleConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = DoubleDoubleConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mFloatDoubleConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = FloatDoubleConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mLongDoubleConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LongDoubleConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mIntOctalConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = IntOctalConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mLongOctalConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LongOctalConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mUnsignedOctalConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = UnsignedOctalConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mIntIntConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = IntIntConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mLongIntConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LongIntConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mUnsignedIntConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = UnsignedIntConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mIntHexConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = IntHexConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mLongHexConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LongHexConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mUnsignedHexConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = UnsignedHexConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - - private static final long[] mk_tokenSet_0() { - long[] data = new long[8]; - data[0]=8589934584L; - data[1]=-9223372036854775808L; - for (int i = 2; i<=3; i++) { data[i]=-1L; } - return data; - } - public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); - private static final long[] mk_tokenSet_1() { - long[] data = new long[8]; - data[0]=8589925368L; - data[1]=-9223372036854775808L; - for (int i = 2; i<=3; i++) { data[i]=-1L; } - return data; - } - public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); - private static final long[] mk_tokenSet_2() { - long[] data = new long[8]; - data[0]=-4398046520328L; - for (int i = 1; i<=3; i++) { data[i]=-1L; } - return data; - } - public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); - private static final long[] mk_tokenSet_3() { - long[] data = new long[8]; - data[0]=-1032L; - for (int i = 1; i<=3; i++) { data[i]=-1L; } - return data; - } - public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3()); - private static final long[] mk_tokenSet_4() { - long[] data = { 4294971904L, 17592186044416L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4()); - private static final long[] mk_tokenSet_5() { - long[] data = { 288019274214150656L, 2199023255552L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5()); - private static final long[] mk_tokenSet_6() { - long[] data = { 288019274214150656L, 81152891680722976L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6()); - private static final long[] mk_tokenSet_7() { - long[] data = { 0L, 576460745995190270L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7()); - private static final long[] mk_tokenSet_8() { - long[] data = new long[8]; - data[0]=-9224L; - for (int i = 1; i<=3; i++) { data[i]=-1L; } - return data; - } - public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8()); - private static final long[] mk_tokenSet_9() { - long[] data = { 288019269919178752L, 137438953504L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9()); - private static final long[] mk_tokenSet_10() { - long[] data = { -9151595350857875456L, 95772161741946880L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_10 = new BitSet(mk_tokenSet_10()); - private static final long[] mk_tokenSet_11() { - long[] data = new long[8]; - data[0]=-17179878408L; - data[1]=-268435457L; - for (int i = 2; i<=3; i++) { data[i]=-1L; } - return data; - } - public static final BitSet _tokenSet_11 = new BitSet(mk_tokenSet_11()); - private static final long[] mk_tokenSet_12() { - long[] data = { 287949450930814976L, 541165879422L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_12 = new BitSet(mk_tokenSet_12()); - private static final long[] mk_tokenSet_13() { - long[] data = new long[8]; - data[0]=-549755813896L; - for (int i = 1; i<=3; i++) { data[i]=-1L; } - return data; - } - public static final BitSet _tokenSet_13 = new BitSet(mk_tokenSet_13()); - - } diff --git a/app/preproc/StdCParser.g b/app/preproc/StdCParser.g deleted file mode 100755 index 44d7a2c5b..000000000 --- a/app/preproc/StdCParser.g +++ /dev/null @@ -1,1358 +0,0 @@ -/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - Copyright (c) Non, Inc. 1997 -- All Rights Reserved - -PROJECT: C Compiler -MODULE: Parser -FILE: stdc.g - -AUTHOR: John D. Mitchell (john@non.net), Jul 12, 1997 - -REVISION HISTORY: - - Name Date Description - ---- ---- ----------- - JDM 97.07.12 Initial version. - JTC 97.11.18 Declaration vs declarator & misc. hacking. - JDM 97.11.20 Fixed: declaration vs funcDef, - parenthesized expressions, - declarator iteration, - varargs recognition, - empty source file recognition, - and some typos. - - -DESCRIPTION: - - This grammar supports the Standard C language. - - Note clearly that this grammar does *NOT* deal with - preprocessor functionality (including things like trigraphs) - Nor does this grammar deal with multi-byte characters nor strings - containing multi-byte characters [these constructs are "exercises - for the reader" as it were :-)]. - - Please refer to the ISO/ANSI C Language Standard if you believe - this grammar to be in error. Please cite chapter and verse in any - correspondence to the author to back up your claim. - -TODO: - - - typedefName is commented out, needs a symbol table to resolve - ambiguity. - - - trees - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ - - -header{ -package processing.app.preproc; -import java.io.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; -} - - -class StdCParser extends Parser; - -options - { - k = 2; - exportVocab = STDC; - buildAST = true; - ASTLabelType = "TNode"; - - // Copied following options from java grammar. - codeGenMakeSwitchThreshold = 2; - codeGenBitsetTestThreshold = 3; - } - - -{ - // Suppport C++-style single-line comments? - public static boolean CPPComments = true; - - // access to symbol table - public CSymbolTable symbolTable = new CSymbolTable(); - - // source for names to unnamed scopes - protected int unnamedScopeCounter = 0; - - public boolean isTypedefName(String name) { - boolean returnValue = false; - TNode node = symbolTable.lookupNameInCurrentScope(name); - for (; node != null; node = (TNode) node.getNextSibling() ) { - if(node.getType() == LITERAL_typedef) { - returnValue = true; - break; - } - } - return returnValue; - } - - - public String getAScopeName() { - return "" + (unnamedScopeCounter++); - } - - public void pushScope(String scopeName) { - symbolTable.pushScope(scopeName); - } - - public void popScope() { - symbolTable.popScope(); - } - - int traceDepth = 0; - public void reportError(RecognitionException ex) { - try { - System.err.println("ANTLR Parsing Error: "+ex + " token name:" + tokenNames[LA(1)]); - ex.printStackTrace(System.err); - } - catch (TokenStreamException e) { - System.err.println("ANTLR Parsing Error: "+ex); - ex.printStackTrace(System.err); - } - } - public void reportError(String s) { - System.err.println("ANTLR Parsing Error from String: " + s); - } - public void reportWarning(String s) { - System.err.println("ANTLR Parsing Warning from String: " + s); - } - public void match(int t) throws MismatchedTokenException { - boolean debugging = false; - - if ( debugging ) { - for (int x=0; x0)?" [inputState.guessing "+ inputState.guessing + "]":"")); - - } - - } - try { - if ( LA(1)!=t ) { - if ( debugging ){ - for (int x=0; x "+rname+"; LA(1)==("+ tokenNames[LT(1).getType()] - + ") " + LT(1).getText() + " [inputState.guessing "+ inputState.guessing + "]"); - } - catch (TokenStreamException e) { - } - } - public void traceOut(String rname) { - for (int x=0; x declaration - | functionDef - | asm_expr - ; - - -asm_expr - : "asm"^ - ("volatile")? LCURLY! expr RCURLY! SEMI! - ; - - -declaration - { AST ds1 = null; } - : ds:declSpecifiers { ds1 = astFactory.dupList(#ds); } - ( - initDeclList[ds1] - )? - SEMI! - { ## = #( #[NDeclaration], ##); } - - ; - - -declSpecifiers - { int specCount=0; } - : ( options { // this loop properly aborts when - // it finds a non-typedefName ID MBZ - warnWhenFollowAmbig = false; - } : - s:storageClassSpecifier - | typeQualifier - | ( "struct" | "union" | "enum" | typeSpecifier[specCount] )=> - specCount = typeSpecifier[specCount] - )+ - ; - -storageClassSpecifier - : "auto" - | "register" - | "typedef" - | functionStorageClassSpecifier - ; - - -functionStorageClassSpecifier - : "extern" - | "static" - ; - - -typeQualifier - : "const" - | "volatile" - ; - -typeSpecifier [int specCount] returns [int retSpecCount] - { retSpecCount = specCount + 1; } - : - ( "void" - | "char" - | "short" - | "int" - | "long" - | "float" - | "double" - | "signed" - | "unsigned" - | structOrUnionSpecifier - | enumSpecifier - | { specCount == 0 }? typedefName - ) - ; - - -typedefName - : { isTypedefName ( LT(1).getText() ) }? - i:ID { ## = #(#[NTypedefName], #i); } - ; - -structOrUnionSpecifier - { String scopeName; } - : sou:structOrUnion! - ( ( ID LCURLY )=> i:ID l:LCURLY - { - scopeName = #sou.getText() + " " + #i.getText(); - #l.setText(scopeName); - pushScope(scopeName); - } - structDeclarationList - { popScope();} - RCURLY! - | l1:LCURLY - { - scopeName = getAScopeName(); - #l1.setText(scopeName); - pushScope(scopeName); - } - structDeclarationList - { popScope(); } - RCURLY! - | ID - ) - { - ## = #( #sou, ## ); - } - ; - - -structOrUnion - : "struct" - | "union" - ; - - -structDeclarationList - : ( structDeclaration )+ - ; - - -structDeclaration - : specifierQualifierList structDeclaratorList ( SEMI! )+ - ; - - -specifierQualifierList - { int specCount = 0; } - : ( options { // this loop properly aborts when - // it finds a non-typedefName ID MBZ - warnWhenFollowAmbig = false; - } : - ( "struct" | "union" | "enum" | typeSpecifier[specCount] )=> - specCount = typeSpecifier[specCount] - | typeQualifier - )+ - ; - - -structDeclaratorList - : structDeclarator ( COMMA! structDeclarator )* - ; - - -structDeclarator - : - ( COLON constExpr - | declarator[false] ( COLON constExpr )? - ) - { ## = #( #[NStructDeclarator], ##); } - ; - - -enumSpecifier - : "enum"^ - ( ( ID LCURLY )=> i:ID LCURLY enumList[i.getText()] RCURLY! - | LCURLY enumList["anonymous"] RCURLY! - | ID - ) - ; - - -enumList[String enumName] - : enumerator[enumName] ( COMMA! enumerator[enumName] )* - ; - -enumerator[String enumName] - : i:ID { symbolTable.add( i.getText(), - #( null, - #[LITERAL_enum, "enum"], - #[ ID, enumName] - ) - ); - } - (ASSIGN constExpr)? - ; - - -initDeclList[AST declarationSpecifiers] - : initDecl[declarationSpecifiers] - ( COMMA! initDecl[declarationSpecifiers] )* - ; - - -initDecl[AST declarationSpecifiers] - { String declName = ""; } - : declName = d:declarator[false] - { AST ds1, d1; - ds1 = astFactory.dupList(declarationSpecifiers); - d1 = astFactory.dupList(#d); - symbolTable.add(declName, #(null, ds1, d1) ); - } - ( ASSIGN initializer - | COLON expr - )? - { ## = #( #[NInitDecl], ## ); } - - ; - -pointerGroup - : ( STAR ( typeQualifier )* )+ { ## = #( #[NPointerGroup], ##); } - ; - - - -idList - : ID ( COMMA! ID )* - ; - - -initializer - : ( assignExpr - | LCURLY initializerList ( COMMA! )? RCURLY! - ) - { ## = #( #[NInitializer], ## ); } - ; - - -initializerList - : initializer ( COMMA! initializer )* - ; - - -declarator[boolean isFunctionDefinition] returns [String declName] - { declName = ""; } - : - ( pointerGroup )? - - ( id:ID { declName = id.getText(); } - | LPAREN declName = declarator[false] RPAREN - ) - - ( ! LPAREN - { - if (isFunctionDefinition) { - pushScope(declName); - } - else { - pushScope("!"+declName); - } - } - ( - (declSpecifiers)=> p:parameterTypeList - { - ## = #( null, ##, #( #[NParameterTypeList], #p ) ); - } - - | (i:idList)? - { - ## = #( null, ##, #( #[NParameterTypeList], #i ) ); - } - ) - { - popScope(); - } - RPAREN - | LBRACKET ( constExpr )? RBRACKET - )* - { ## = #( #[NDeclarator], ## ); } - ; - -parameterTypeList - : parameterDeclaration - ( options { - warnWhenFollowAmbig = false; - } : - COMMA! - parameterDeclaration - )* - ( COMMA! - VARARGS - )? - ; - - -parameterDeclaration - { String declName; } - : ds:declSpecifiers - ( ( declarator[false] )=> declName = d:declarator[false] - { - AST d2, ds2; - d2 = astFactory.dupList(#d); - ds2 = astFactory.dupList(#ds); - symbolTable.add(declName, #(null, ds2, d2)); - } - | nonemptyAbstractDeclarator - )? - { - ## = #( #[NParameterDeclaration], ## ); - } - ; - -/* JTC: - * This handles both new and old style functions. - * see declarator rule to see differences in parameters - * and here (declaration SEMI)* is the param type decls for the - * old style. may want to do some checking to check for illegal - * combinations (but I assume all parsed code will be legal?) - */ - -functionDef - { String declName; } - : ( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers - | //epsilon - ) - declName = d:declarator[true] - { - AST d2, ds2; - d2 = astFactory.dupList(#d); - ds2 = astFactory.dupList(#ds); - symbolTable.add(declName, #(null, ds2, d2)); - pushScope(declName); - } - ( declaration )* (VARARGS)? ( SEMI! )* - { popScope(); } - compoundStatement[declName] - { ## = #( #[NFunctionDef], ## );} - ; - -functionDeclSpecifiers - { int specCount = 0; } - : ( options { // this loop properly aborts when - // it finds a non-typedefName ID MBZ - warnWhenFollowAmbig = false; - } : - functionStorageClassSpecifier - | typeQualifier - | ( "struct" | "union" | "enum" | typeSpecifier[specCount] )=> - specCount = typeSpecifier[specCount] - )+ - ; - -declarationList - : ( options { // this loop properly aborts when - // it finds a non-typedefName ID MBZ - warnWhenFollowAmbig = false; - } : - ( declarationPredictor )=> declaration - )+ - ; - -declarationPredictor - : (options { //only want to look at declaration if I don't see typedef - warnWhenFollowAmbig = false; - }: - "typedef" - | declaration - ) - ; - - -compoundStatement[String scopeName] - : LCURLY! - { - pushScope(scopeName); - } - ( ( declarationPredictor)=> declarationList )? - ( statementList )? - { popScope(); } - RCURLY! - { ## = #( #[NCompoundStatement, scopeName], ##); } - ; - - -statementList - : ( statement )+ - ; -statement - : SEMI // Empty statements - - | compoundStatement[getAScopeName()] // Group of statements - - | expr SEMI! { ## = #( #[NStatementExpr], ## ); } // Expressions - -// Iteration statements: - - | "while"^ LPAREN! expr RPAREN! statement - | "do"^ statement "while"! LPAREN! expr RPAREN! SEMI! - |! "for" - LPAREN ( e1:expr )? SEMI ( e2:expr )? SEMI ( e3:expr )? RPAREN - s:statement - { - if ( #e1 == null) { #e1 = #[ NEmptyExpression ]; } - if ( #e2 == null) { #e2 = #[ NEmptyExpression ]; } - if ( #e3 == null) { #e3 = #[ NEmptyExpression ]; } - ## = #( #[LITERAL_for, "for"], #e1, #e2, #e3, #s ); - } - - -// Jump statements: - - | "goto"^ ID SEMI! - | "continue" SEMI! - | "break" SEMI! - | "return"^ ( expr )? SEMI! - - -// Labeled statements: - | ID COLON! (options {warnWhenFollowAmbig=false;}:statement)? { ## = #( #[NLabel], ## ); } - | "case"^ constExpr COLON! statement - | "default"^ COLON! statement - - - -// Selection statements: - - | "if"^ - LPAREN! expr RPAREN! statement - ( //standard if-else ambiguity - options { - warnWhenFollowAmbig = false; - } : - "else" statement )? - | "switch"^ LPAREN! expr RPAREN! statement - ; - - - - - - -expr - : assignExpr (options { - /* MBZ: - COMMA is ambiguous between comma expressions and - argument lists. argExprList should get priority, - and it does by being deeper in the expr rule tree - and using (COMMA assignExpr)* - */ - warnWhenFollowAmbig = false; - } : - c:COMMA^ { #c.setType(NCommaExpr); } assignExpr - )* - ; - - -assignExpr - : conditionalExpr ( a:assignOperator! assignExpr { ## = #( #a, ## );} )? - ; - -assignOperator - : ASSIGN - | DIV_ASSIGN - | PLUS_ASSIGN - | MINUS_ASSIGN - | STAR_ASSIGN - | MOD_ASSIGN - | RSHIFT_ASSIGN - | LSHIFT_ASSIGN - | BAND_ASSIGN - | BOR_ASSIGN - | BXOR_ASSIGN - ; - - -conditionalExpr - : logicalOrExpr - ( QUESTION^ expr COLON! conditionalExpr )? - ; - - -constExpr - : conditionalExpr - ; - -logicalOrExpr - : logicalAndExpr ( LOR^ logicalAndExpr )* - ; - - -logicalAndExpr - : inclusiveOrExpr ( LAND^ inclusiveOrExpr )* - ; - -inclusiveOrExpr - : exclusiveOrExpr ( BOR^ exclusiveOrExpr )* - ; - - -exclusiveOrExpr - : bitAndExpr ( BXOR^ bitAndExpr )* - ; - - -bitAndExpr - : equalityExpr ( BAND^ equalityExpr )* - ; - - - -equalityExpr - : relationalExpr - ( ( EQUAL^ | NOT_EQUAL^ ) relationalExpr )* - ; - - -relationalExpr - : shiftExpr - ( ( LT^ | LTE^ | GT^ | GTE^ ) shiftExpr )* - ; - - - -shiftExpr - : additiveExpr - ( ( LSHIFT^ | RSHIFT^ ) additiveExpr )* - ; - - -additiveExpr - : multExpr - ( ( PLUS^ | MINUS^ ) multExpr )* - ; - - -multExpr - : castExpr - ( ( STAR^ | DIV^ | MOD^ ) castExpr )* - ; - - -castExpr - : ( LPAREN typeName RPAREN )=> - LPAREN! typeName RPAREN! ( castExpr ) - { ## = #( #[NCast, "("], ## ); } - - | unaryExpr - ; - - -typeName - : specifierQualifierList (nonemptyAbstractDeclarator)? - ; - -nonemptyAbstractDeclarator - : ( - pointerGroup - ( (LPAREN - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - RPAREN) - | (LBRACKET (expr)? RBRACKET) - )* - - | ( (LPAREN - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - RPAREN) - | (LBRACKET (expr)? RBRACKET) - )+ - ) - { ## = #( #[NNonemptyAbstractDeclarator], ## ); } - - ; - -/* JTC: - -LR rules: - -abstractDeclarator - : nonemptyAbstractDeclarator - | // null - ; - -nonemptyAbstractDeclarator - : LPAREN nonemptyAbstractDeclarator RPAREN - | abstractDeclarator LPAREN RPAREN - | abstractDeclarator (LBRACKET (expr)? RBRACKET) - | STAR abstractDeclarator - ; -*/ - -unaryExpr - : postfixExpr - | INC^ unaryExpr - | DEC^ unaryExpr - | u:unaryOperator castExpr { ## = #( #[NUnaryExpr], ## ); } - - | "sizeof"^ - ( ( LPAREN typeName )=> LPAREN typeName RPAREN - | unaryExpr - ) - ; - - -unaryOperator - : BAND - | STAR - | PLUS - | MINUS - | BNOT - | LNOT - ; - -postfixExpr - : primaryExpr - ( - postfixSuffix {## = #( #[NPostfixExpr], ## );} - )? - ; -postfixSuffix - : - ( PTR ID - | DOT ID - | functionCall - | LBRACKET expr RBRACKET - | INC - | DEC - )+ - ; - -functionCall - : - LPAREN^ (a:argExprList)? RPAREN - { - ##.setType( NFunctionCallArgs ); - } - ; - - -primaryExpr - : ID - | charConst - | intConst - | floatConst - | stringConst - -// JTC: -// ID should catch the enumerator -// leaving it in gives ambiguous err -// | enumerator - | LPAREN! expr RPAREN! { ## = #( #[NExpressionGroup, "("], ## ); } - ; - -argExprList - : assignExpr ( COMMA! assignExpr )* - ; - - - -protected -charConst - : CharLiteral - ; - - -protected -stringConst - : (StringLiteral)+ { ## = #(#[NStringSeq], ##); } - ; - - -protected -intConst - : IntOctalConst - | LongOctalConst - | UnsignedOctalConst - | IntIntConst - | LongIntConst - | UnsignedIntConst - | IntHexConst - | LongHexConst - | UnsignedHexConst - ; - - -protected -floatConst - : FloatDoubleConst - | DoubleDoubleConst - | LongDoubleConst - ; - - - - - - -dummy - : NTypedefName - | NInitDecl - | NDeclarator - | NStructDeclarator - | NDeclaration - | NCast - | NPointerGroup - | NExpressionGroup - | NFunctionCallArgs - | NNonemptyAbstractDeclarator - | NInitializer - | NStatementExpr - | NEmptyExpression - | NParameterTypeList - | NFunctionDef - | NCompoundStatement - | NParameterDeclaration - | NCommaExpr - | NUnaryExpr - | NLabel - | NPostfixExpr - | NRangeExpr - | NStringSeq - | NInitializerElementLabel - | NLcurlyInitializer - | NAsmAttribute - | NGnuAsmExpr - | NTypeMissing - ; - - - - - - -{ -// import CToken; - import java.io.*; -// import LineObject; - import antlr.*; -} - -class StdCLexer extends Lexer; - -options - { - k = 3; - exportVocab = STDC; - testLiterals = false; - } - -{ - LineObject lineObject = new LineObject(); - String originalSource = ""; - PreprocessorInfoChannel preprocessorInfoChannel = new PreprocessorInfoChannel(); - int tokenNumber = 0; - boolean countingTokens = true; - int deferredLineCount = 0; - - public void setCountingTokens(boolean ct) - { - countingTokens = ct; - if ( countingTokens ) { - tokenNumber = 0; - } - else { - tokenNumber = 1; - } - } - - public void setOriginalSource(String src) - { - originalSource = src; - lineObject.setSource(src); - } - public void setSource(String src) - { - lineObject.setSource(src); - } - - public PreprocessorInfoChannel getPreprocessorInfoChannel() - { - return preprocessorInfoChannel; - } - - public void setPreprocessingDirective(String pre) - { - preprocessorInfoChannel.addLineForTokenNumber( pre, new Integer(tokenNumber) ); - } - - protected Token makeToken(int t) - { - if ( t != Token.SKIP && countingTokens) { - tokenNumber++; - } - CToken tok = (CToken) super.makeToken(t); - tok.setLine(lineObject.line); - tok.setSource(lineObject.source); - tok.setTokenNumber(tokenNumber); - - lineObject.line += deferredLineCount; - deferredLineCount = 0; - return tok; - } - - public void deferredNewline() { - deferredLineCount++; - } - - public void newline() { - lineObject.newline(); - } - - - - - - -} - -protected -Vocabulary - : '\3'..'\377' - ; - - -/* Operators: */ - -ASSIGN : '=' ; -COLON : ':' ; -COMMA : ',' ; -QUESTION : '?' ; -SEMI : ';' ; -PTR : "->" ; - - -// DOT & VARARGS are commented out since they are generated as part of -// the Number rule below due to some bizarre lexical ambiguity shme. - -// DOT : '.' ; -protected -DOT:; - -// VARARGS : "..." ; -protected -VARARGS:; - - -LPAREN : '(' ; -RPAREN : ')' ; -LBRACKET : '[' ; -RBRACKET : ']' ; -LCURLY : '{' ; -RCURLY : '}' ; - -EQUAL : "==" ; -NOT_EQUAL : "!=" ; -LTE : "<=" ; -LT : "<" ; -GTE : ">=" ; -GT : ">" ; - -DIV : '/' ; -DIV_ASSIGN : "/=" ; -PLUS : '+' ; -PLUS_ASSIGN : "+=" ; -INC : "++" ; -MINUS : '-' ; -MINUS_ASSIGN : "-=" ; -DEC : "--" ; -STAR : '*' ; -STAR_ASSIGN : "*=" ; -MOD : '%' ; -MOD_ASSIGN : "%=" ; -RSHIFT : ">>" ; -RSHIFT_ASSIGN : ">>=" ; -LSHIFT : "<<" ; -LSHIFT_ASSIGN : "<<=" ; - -LAND : "&&" ; -LNOT : '!' ; -LOR : "||" ; - -BAND : '&' ; -BAND_ASSIGN : "&=" ; -BNOT : '~' ; -BOR : '|' ; -BOR_ASSIGN : "|=" ; -BXOR : '^' ; -BXOR_ASSIGN : "^=" ; - - -Whitespace - : ( ( '\003'..'\010' | '\t' | '\013' | '\f' | '\016'.. '\037' | '\177'..'\377' | ' ' ) - | "\r\n" { newline(); } - | ( '\n' | '\r' ) { newline(); } - ) { _ttype = Token.SKIP; } - ; - - -Comment - : "/*" - ( { LA(2) != '/' }? '*' - | "\r\n" { deferredNewline(); } - | ( '\r' | '\n' ) { deferredNewline(); } - | ~( '*'| '\r' | '\n' ) - )* - "*/" { _ttype = Token.SKIP; - } - ; - - -CPPComment - : - "//" ( ~('\n') )* - { - _ttype = Token.SKIP; - } - ; - -PREPROC_DIRECTIVE -options { - paraphrase = "a line directive"; -} - - : - '#' - ( ( "line" || (( ' ' | '\t' | '\014')+ '0'..'9')) => LineDirective - | (~'\n')* { setPreprocessingDirective(getText()); } - ) - { - _ttype = Token.SKIP; - } - ; - -protected Space: - ( ' ' | '\t' | '\014') - ; - -protected LineDirective -{ - boolean oldCountingTokens = countingTokens; - countingTokens = false; -} -: - { - lineObject = new LineObject(); - deferredLineCount = 0; - } - ("line")? //this would be for if the directive started "#line", but not there for GNU directives - (Space)+ - n:Number { lineObject.setLine(Integer.parseInt(n.getText())); } - (Space)+ - ( fn:StringLiteral { try { - lineObject.setSource(fn.getText().substring(1,fn.getText().length()-1)); - } - catch (StringIndexOutOfBoundsException e) { /*not possible*/ } - } - | fi:ID { lineObject.setSource(fi.getText()); } - )? - (Space)* - ("1" { lineObject.setEnteringFile(true); } )? - (Space)* - ("2" { lineObject.setReturningToFile(true); } )? - (Space)* - ("3" { lineObject.setSystemHeader(true); } )? - (Space)* - ("4" { lineObject.setTreatAsC(true); } )? - (~('\r' | '\n'))* - ("\r\n" | "\r" | "\n") - { - preprocessorInfoChannel.addLineForTokenNumber(new LineObject(lineObject), new Integer(tokenNumber)); - countingTokens = oldCountingTokens; - } - ; - - - -/* Literals: */ - -/* - * Note that we do NOT handle tri-graphs nor multi-byte sequences. - */ - - -/* - * Note that we can't have empty character constants (even though we - * can have empty strings :-). - */ -CharLiteral - : '\'' ( Escape | ~( '\'' ) ) '\'' - ; - - -/* - * Can't have raw imbedded newlines in string constants. Strict reading of - * the standard gives odd dichotomy between newlines & carriage returns. - * Go figure. - */ -StringLiteral - : '"' - ( Escape - | ( - '\r' { deferredNewline(); } - | '\n' { - deferredNewline(); - _ttype = BadStringLiteral; - } - | '\\' '\n' { - deferredNewline(); - } - ) - | ~( '"' | '\r' | '\n' | '\\' ) - )* - '"' - ; - - -protected BadStringLiteral - : // Imaginary token. - ; - - -/* - * Handle the various escape sequences. - * - * Note carefully that these numeric escape *sequences* are *not* of the - * same form as the C language numeric *constants*. - * - * There is no such thing as a binary numeric escape sequence. - * - * Octal escape sequences are either 1, 2, or 3 octal digits exactly. - * - * There is no such thing as a decimal escape sequence. - * - * Hexadecimal escape sequences are begun with a leading \x and continue - * until a non-hexadecimal character is found. - * - * No real handling of tri-graph sequences, yet. - */ - -protected -Escape - : '\\' - ( options{warnWhenFollowAmbig=false;}: - 'a' - | 'b' - | 'f' - | 'n' - | 'r' - | 't' - | 'v' - | '"' - | '\'' - | '\\' - | '?' - | ('0'..'3') ( options{warnWhenFollowAmbig=false;}: Digit ( options{warnWhenFollowAmbig=false;}: Digit )? )? - | ('4'..'7') ( options{warnWhenFollowAmbig=false;}: Digit )? - | 'x' ( options{warnWhenFollowAmbig=false;}: Digit | 'a'..'f' | 'A'..'F' )+ - ) - ; - - -/* Numeric Constants: */ - -protected -Digit - : '0'..'9' - ; - -protected -LongSuffix - : 'l' - | 'L' - ; - -protected -UnsignedSuffix - : 'u' - | 'U' - ; - -protected -FloatSuffix - : 'f' - | 'F' - ; - -protected -Exponent - : ( 'e' | 'E' ) ( '+' | '-' )? ( Digit )+ - ; - - -protected -DoubleDoubleConst:; - -protected -FloatDoubleConst:; - -protected -LongDoubleConst:; - -protected -IntOctalConst:; - -protected -LongOctalConst:; - -protected -UnsignedOctalConst:; - -protected -IntIntConst:; - -protected -LongIntConst:; - -protected -UnsignedIntConst:; - -protected -IntHexConst:; - -protected -LongHexConst:; - -protected -UnsignedHexConst:; - - - - -Number - : ( ( Digit )+ ( '.' | 'e' | 'E' ) )=> ( Digit )+ - ( '.' ( Digit )* ( Exponent )? - | Exponent - ) { _ttype = DoubleDoubleConst; } - ( FloatSuffix { _ttype = FloatDoubleConst; } - | LongSuffix { _ttype = LongDoubleConst; } - )? - - | ( "..." )=> "..." { _ttype = VARARGS; } - - | '.' { _ttype = DOT; } - ( ( Digit )+ ( Exponent )? - { _ttype = DoubleDoubleConst; } - ( FloatSuffix { _ttype = FloatDoubleConst; } - | LongSuffix { _ttype = LongDoubleConst; } - )? - )? - - | '0' ( '0'..'7' )* { _ttype = IntOctalConst; } - ( LongSuffix { _ttype = LongOctalConst; } - | UnsignedSuffix { _ttype = UnsignedOctalConst; } - )? - - | '1'..'9' ( Digit )* { _ttype = IntIntConst; } - ( LongSuffix { _ttype = LongIntConst; } - | UnsignedSuffix { _ttype = UnsignedIntConst; } - )? - - | '0' ( 'x' | 'X' ) ( 'a'..'f' | 'A'..'F' | Digit )+ - { _ttype = IntHexConst; } - ( LongSuffix { _ttype = LongHexConst; } - | UnsignedSuffix { _ttype = UnsignedHexConst; } - )? - ; - - -ID - options - { - testLiterals = true; - } - : ( 'a'..'z' | 'A'..'Z' | '_' ) - ( 'a'..'z' | 'A'..'Z' | '_' | '0'..'9' )* - ; - - diff --git a/app/preproc/StdCParser.java b/app/preproc/StdCParser.java deleted file mode 100644 index ce313ad12..000000000 --- a/app/preproc/StdCParser.java +++ /dev/null @@ -1,5886 +0,0 @@ -// $ANTLR 2.7.2: "StdCParser.g" -> "StdCParser.java"$ - -package processing.app.preproc; -import java.io.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; - -import antlr.TokenBuffer; -import antlr.TokenStreamException; -import antlr.TokenStreamIOException; -import antlr.ANTLRException; -import antlr.LLkParser; -import antlr.Token; -import antlr.TokenStream; -import antlr.RecognitionException; -import antlr.NoViableAltException; -import antlr.MismatchedTokenException; -import antlr.SemanticException; -import antlr.ParserSharedInputState; -import antlr.collections.impl.BitSet; -import antlr.collections.AST; -import java.util.Hashtable; -import antlr.ASTFactory; -import antlr.ASTPair; -import antlr.collections.impl.ASTArray; - -public class StdCParser extends antlr.LLkParser implements STDCTokenTypes - { - - // Suppport C++-style single-line comments? - public static boolean CPPComments = true; - - // access to symbol table - public CSymbolTable symbolTable = new CSymbolTable(); - - // source for names to unnamed scopes - protected int unnamedScopeCounter = 0; - - public boolean isTypedefName(String name) { - boolean returnValue = false; - TNode node = symbolTable.lookupNameInCurrentScope(name); - for (; node != null; node = (TNode) node.getNextSibling() ) { - if(node.getType() == LITERAL_typedef) { - returnValue = true; - break; - } - } - return returnValue; - } - - - public String getAScopeName() { - return "" + (unnamedScopeCounter++); - } - - public void pushScope(String scopeName) { - symbolTable.pushScope(scopeName); - } - - public void popScope() { - symbolTable.popScope(); - } - - int traceDepth = 0; - public void reportError(RecognitionException ex) { - try { - System.err.println("ANTLR Parsing Error: "+ex + " token name:" + tokenNames[LA(1)]); - ex.printStackTrace(System.err); - } - catch (TokenStreamException e) { - System.err.println("ANTLR Parsing Error: "+ex); - ex.printStackTrace(System.err); - } - } - public void reportError(String s) { - System.err.println("ANTLR Parsing Error from String: " + s); - } - public void reportWarning(String s) { - System.err.println("ANTLR Parsing Warning from String: " + s); - } - public void match(int t) throws MismatchedTokenException { - boolean debugging = false; - - if ( debugging ) { - for (int x=0; x0)?" [inputState.guessing "+ inputState.guessing + "]":"")); - - } - - } - try { - if ( LA(1)!=t ) { - if ( debugging ){ - for (int x=0; x "+rname+"; LA(1)==("+ tokenNames[LT(1).getType()] - + ") " + LT(1).getText() + " [inputState.guessing "+ inputState.guessing + "]"); - } - catch (TokenStreamException e) { - } - } - public void traceOut(String rname) { - for (int x=0; x=1 ) { break _loop4; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt4++; - } while (true); - } - externalList_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_0); - } else { - throw ex; - } - } - returnAST = externalList_AST; - } - - public final void externalDef() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode externalDef_AST = null; - - try { // for error handling - boolean synPredMatched7 = false; - if (((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2))))) { - int _m7 = mark(); - synPredMatched7 = true; - inputState.guessing++; - try { - { - if ((LA(1)==LITERAL_typedef) && (true)) { - match(LITERAL_typedef); - } - else if ((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2)))) { - declaration(); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - } - catch (RecognitionException pe) { - synPredMatched7 = false; - } - rewind(_m7); - inputState.guessing--; - } - if ( synPredMatched7 ) { - declaration(); - astFactory.addASTChild(currentAST, returnAST); - externalDef_AST = (TNode)currentAST.root; - } - else if ((_tokenSet_4.member(LA(1))) && (_tokenSet_5.member(LA(2)))) { - functionDef(); - astFactory.addASTChild(currentAST, returnAST); - externalDef_AST = (TNode)currentAST.root; - } - else if ((LA(1)==LITERAL_asm)) { - asm_expr(); - astFactory.addASTChild(currentAST, returnAST); - externalDef_AST = (TNode)currentAST.root; - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_6); - } else { - throw ex; - } - } - returnAST = externalDef_AST; - } - - public final void declaration() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode declaration_AST = null; - TNode ds_AST = null; - AST ds1 = null; - - try { // for error handling - declSpecifiers(); - ds_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - ds1 = astFactory.dupList(ds_AST); - } - { - switch ( LA(1)) { - case ID: - case STAR: - case LPAREN: - { - initDeclList(ds1); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - match(SEMI); - if ( inputState.guessing==0 ) { - declaration_AST = (TNode)currentAST.root; - declaration_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NDeclaration)).add(declaration_AST)); - currentAST.root = declaration_AST; - currentAST.child = declaration_AST!=null &&declaration_AST.getFirstChild()!=null ? - declaration_AST.getFirstChild() : declaration_AST; - currentAST.advanceChildToEnd(); - } - declaration_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_7); - } else { - throw ex; - } - } - returnAST = declaration_AST; - } - - public final void functionDef() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode functionDef_AST = null; - TNode ds_AST = null; - TNode d_AST = null; - String declName; - - try { // for error handling - { - boolean synPredMatched94 = false; - if (((_tokenSet_8.member(LA(1))) && (_tokenSet_9.member(LA(2))))) { - int _m94 = mark(); - synPredMatched94 = true; - inputState.guessing++; - try { - { - functionDeclSpecifiers(); - } - } - catch (RecognitionException pe) { - synPredMatched94 = false; - } - rewind(_m94); - inputState.guessing--; - } - if ( synPredMatched94 ) { - functionDeclSpecifiers(); - ds_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_10.member(LA(1))) && (_tokenSet_5.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - declName=declarator(true); - d_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - - AST d2, ds2; - d2 = astFactory.dupList(d_AST); - ds2 = astFactory.dupList(ds_AST); - symbolTable.add(declName, (TNode)astFactory.make( (new ASTArray(3)).add(null).add(ds2).add(d2))); - pushScope(declName); - - } - { - _loop96: - do { - if ((_tokenSet_2.member(LA(1)))) { - declaration(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop96; - } - - } while (true); - } - { - switch ( LA(1)) { - case VARARGS: - { - TNode tmp2_AST = null; - tmp2_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp2_AST); - match(VARARGS); - break; - } - case LCURLY: - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - _loop99: - do { - if ((LA(1)==SEMI)) { - match(SEMI); - } - else { - break _loop99; - } - - } while (true); - } - if ( inputState.guessing==0 ) { - popScope(); - } - compoundStatement(declName); - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - functionDef_AST = (TNode)currentAST.root; - functionDef_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NFunctionDef)).add(functionDef_AST)); - currentAST.root = functionDef_AST; - currentAST.child = functionDef_AST!=null &&functionDef_AST.getFirstChild()!=null ? - functionDef_AST.getFirstChild() : functionDef_AST; - currentAST.advanceChildToEnd(); - } - functionDef_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_6); - } else { - throw ex; - } - } - returnAST = functionDef_AST; - } - - public final void asm_expr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode asm_expr_AST = null; - - try { // for error handling - TNode tmp4_AST = null; - tmp4_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp4_AST); - match(LITERAL_asm); - { - switch ( LA(1)) { - case LITERAL_volatile: - { - TNode tmp5_AST = null; - tmp5_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp5_AST); - match(LITERAL_volatile); - break; - } - case LCURLY: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - match(LCURLY); - expr(); - astFactory.addASTChild(currentAST, returnAST); - match(RCURLY); - match(SEMI); - asm_expr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_6); - } else { - throw ex; - } - } - returnAST = asm_expr_AST; - } - - public final void expr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode expr_AST = null; - Token c = null; - TNode c_AST = null; - - try { // for error handling - assignExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop129: - do { - if ((LA(1)==COMMA) && (_tokenSet_11.member(LA(2)))) { - c = LT(1); - c_AST = (TNode)astFactory.create(c); - astFactory.makeASTRoot(currentAST, c_AST); - match(COMMA); - if ( inputState.guessing==0 ) { - c_AST.setType(NCommaExpr); - } - assignExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop129; - } - - } while (true); - } - expr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_12); - } else { - throw ex; - } - } - returnAST = expr_AST; - } - - public final void declSpecifiers() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode declSpecifiers_AST = null; - TNode s_AST = null; - int specCount=0; - - try { // for error handling - { - int _cnt16=0; - _loop16: - do { - switch ( LA(1)) { - case LITERAL_typedef: - case LITERAL_auto: - case LITERAL_register: - case LITERAL_extern: - case LITERAL_static: - { - storageClassSpecifier(); - s_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LITERAL_volatile: - case LITERAL_const: - { - typeQualifier(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - default: - boolean synPredMatched15 = false; - if (((_tokenSet_13.member(LA(1))) && (_tokenSet_14.member(LA(2))))) { - int _m15 = mark(); - synPredMatched15 = true; - inputState.guessing++; - try { - { - if ((LA(1)==LITERAL_struct) && (true)) { - match(LITERAL_struct); - } - else if ((LA(1)==LITERAL_union) && (true)) { - match(LITERAL_union); - } - else if ((LA(1)==LITERAL_enum) && (true)) { - match(LITERAL_enum); - } - else if ((_tokenSet_13.member(LA(1))) && (true)) { - typeSpecifier(specCount); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - } - catch (RecognitionException pe) { - synPredMatched15 = false; - } - rewind(_m15); - inputState.guessing--; - } - if ( synPredMatched15 ) { - specCount=typeSpecifier(specCount); - astFactory.addASTChild(currentAST, returnAST); - } - else { - if ( _cnt16>=1 ) { break _loop16; } else {throw new NoViableAltException(LT(1), getFilename());} - } - } - _cnt16++; - } while (true); - } - declSpecifiers_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_15); - } else { - throw ex; - } - } - returnAST = declSpecifiers_AST; - } - - public final void initDeclList( - AST declarationSpecifiers - ) throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode initDeclList_AST = null; - - try { // for error handling - initDecl(declarationSpecifiers); - astFactory.addASTChild(currentAST, returnAST); - { - _loop56: - do { - if ((LA(1)==COMMA)) { - match(COMMA); - initDecl(declarationSpecifiers); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop56; - } - - } while (true); - } - initDeclList_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_16); - } else { - throw ex; - } - } - returnAST = initDeclList_AST; - } - - public final void storageClassSpecifier() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode storageClassSpecifier_AST = null; - - try { // for error handling - switch ( LA(1)) { - case LITERAL_auto: - { - TNode tmp10_AST = null; - tmp10_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp10_AST); - match(LITERAL_auto); - storageClassSpecifier_AST = (TNode)currentAST.root; - break; - } - case LITERAL_register: - { - TNode tmp11_AST = null; - tmp11_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp11_AST); - match(LITERAL_register); - storageClassSpecifier_AST = (TNode)currentAST.root; - break; - } - case LITERAL_typedef: - { - TNode tmp12_AST = null; - tmp12_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp12_AST); - match(LITERAL_typedef); - storageClassSpecifier_AST = (TNode)currentAST.root; - break; - } - case LITERAL_extern: - case LITERAL_static: - { - functionStorageClassSpecifier(); - astFactory.addASTChild(currentAST, returnAST); - storageClassSpecifier_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_17); - } else { - throw ex; - } - } - returnAST = storageClassSpecifier_AST; - } - - public final void typeQualifier() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode typeQualifier_AST = null; - - try { // for error handling - switch ( LA(1)) { - case LITERAL_const: - { - TNode tmp13_AST = null; - tmp13_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp13_AST); - match(LITERAL_const); - typeQualifier_AST = (TNode)currentAST.root; - break; - } - case LITERAL_volatile: - { - TNode tmp14_AST = null; - tmp14_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp14_AST); - match(LITERAL_volatile); - typeQualifier_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_18); - } else { - throw ex; - } - } - returnAST = typeQualifier_AST; - } - - public final int typeSpecifier( - int specCount - ) throws RecognitionException, TokenStreamException { - int retSpecCount; - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode typeSpecifier_AST = null; - retSpecCount = specCount + 1; - - try { // for error handling - { - switch ( LA(1)) { - case LITERAL_void: - { - TNode tmp15_AST = null; - tmp15_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp15_AST); - match(LITERAL_void); - break; - } - case LITERAL_char: - { - TNode tmp16_AST = null; - tmp16_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp16_AST); - match(LITERAL_char); - break; - } - case LITERAL_short: - { - TNode tmp17_AST = null; - tmp17_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp17_AST); - match(LITERAL_short); - break; - } - case LITERAL_int: - { - TNode tmp18_AST = null; - tmp18_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp18_AST); - match(LITERAL_int); - break; - } - case LITERAL_long: - { - TNode tmp19_AST = null; - tmp19_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp19_AST); - match(LITERAL_long); - break; - } - case LITERAL_float: - { - TNode tmp20_AST = null; - tmp20_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp20_AST); - match(LITERAL_float); - break; - } - case LITERAL_double: - { - TNode tmp21_AST = null; - tmp21_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp21_AST); - match(LITERAL_double); - break; - } - case LITERAL_signed: - { - TNode tmp22_AST = null; - tmp22_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp22_AST); - match(LITERAL_signed); - break; - } - case LITERAL_unsigned: - { - TNode tmp23_AST = null; - tmp23_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp23_AST); - match(LITERAL_unsigned); - break; - } - case LITERAL_struct: - case LITERAL_union: - { - structOrUnionSpecifier(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LITERAL_enum: - { - enumSpecifier(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - default: - if (((LA(1)==ID))&&( specCount == 0 )) { - typedefName(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - typeSpecifier_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_18); - } else { - throw ex; - } - } - returnAST = typeSpecifier_AST; - return retSpecCount; - } - - public final void functionStorageClassSpecifier() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode functionStorageClassSpecifier_AST = null; - - try { // for error handling - switch ( LA(1)) { - case LITERAL_extern: - { - TNode tmp24_AST = null; - tmp24_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp24_AST); - match(LITERAL_extern); - functionStorageClassSpecifier_AST = (TNode)currentAST.root; - break; - } - case LITERAL_static: - { - TNode tmp25_AST = null; - tmp25_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp25_AST); - match(LITERAL_static); - functionStorageClassSpecifier_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_17); - } else { - throw ex; - } - } - returnAST = functionStorageClassSpecifier_AST; - } - - public final void structOrUnionSpecifier() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode structOrUnionSpecifier_AST = null; - TNode sou_AST = null; - Token i = null; - TNode i_AST = null; - Token l = null; - TNode l_AST = null; - Token l1 = null; - TNode l1_AST = null; - String scopeName; - - try { // for error handling - structOrUnion(); - sou_AST = (TNode)returnAST; - { - boolean synPredMatched26 = false; - if (((LA(1)==ID) && (LA(2)==LCURLY))) { - int _m26 = mark(); - synPredMatched26 = true; - inputState.guessing++; - try { - { - match(ID); - match(LCURLY); - } - } - catch (RecognitionException pe) { - synPredMatched26 = false; - } - rewind(_m26); - inputState.guessing--; - } - if ( synPredMatched26 ) { - i = LT(1); - i_AST = (TNode)astFactory.create(i); - astFactory.addASTChild(currentAST, i_AST); - match(ID); - l = LT(1); - l_AST = (TNode)astFactory.create(l); - astFactory.addASTChild(currentAST, l_AST); - match(LCURLY); - if ( inputState.guessing==0 ) { - - scopeName = sou_AST.getText() + " " + i_AST.getText(); - l_AST.setText(scopeName); - pushScope(scopeName); - - } - structDeclarationList(); - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - popScope(); - } - match(RCURLY); - } - else if ((LA(1)==LCURLY)) { - l1 = LT(1); - l1_AST = (TNode)astFactory.create(l1); - astFactory.addASTChild(currentAST, l1_AST); - match(LCURLY); - if ( inputState.guessing==0 ) { - - scopeName = getAScopeName(); - l1_AST.setText(scopeName); - pushScope(scopeName); - - } - structDeclarationList(); - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - popScope(); - } - match(RCURLY); - } - else if ((LA(1)==ID) && (_tokenSet_18.member(LA(2)))) { - TNode tmp28_AST = null; - tmp28_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp28_AST); - match(ID); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - if ( inputState.guessing==0 ) { - structOrUnionSpecifier_AST = (TNode)currentAST.root; - - structOrUnionSpecifier_AST = (TNode)astFactory.make( (new ASTArray(2)).add(sou_AST).add(structOrUnionSpecifier_AST)); - - currentAST.root = structOrUnionSpecifier_AST; - currentAST.child = structOrUnionSpecifier_AST!=null &&structOrUnionSpecifier_AST.getFirstChild()!=null ? - structOrUnionSpecifier_AST.getFirstChild() : structOrUnionSpecifier_AST; - currentAST.advanceChildToEnd(); - } - structOrUnionSpecifier_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_18); - } else { - throw ex; - } - } - returnAST = structOrUnionSpecifier_AST; - } - - public final void enumSpecifier() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode enumSpecifier_AST = null; - Token i = null; - TNode i_AST = null; - - try { // for error handling - TNode tmp29_AST = null; - tmp29_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp29_AST); - match(LITERAL_enum); - { - boolean synPredMatched48 = false; - if (((LA(1)==ID) && (LA(2)==LCURLY))) { - int _m48 = mark(); - synPredMatched48 = true; - inputState.guessing++; - try { - { - match(ID); - match(LCURLY); - } - } - catch (RecognitionException pe) { - synPredMatched48 = false; - } - rewind(_m48); - inputState.guessing--; - } - if ( synPredMatched48 ) { - i = LT(1); - i_AST = (TNode)astFactory.create(i); - astFactory.addASTChild(currentAST, i_AST); - match(ID); - TNode tmp30_AST = null; - tmp30_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp30_AST); - match(LCURLY); - enumList(i.getText()); - astFactory.addASTChild(currentAST, returnAST); - match(RCURLY); - } - else if ((LA(1)==LCURLY)) { - TNode tmp32_AST = null; - tmp32_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp32_AST); - match(LCURLY); - enumList("anonymous"); - astFactory.addASTChild(currentAST, returnAST); - match(RCURLY); - } - else if ((LA(1)==ID) && (_tokenSet_18.member(LA(2)))) { - TNode tmp34_AST = null; - tmp34_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp34_AST); - match(ID); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - enumSpecifier_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_18); - } else { - throw ex; - } - } - returnAST = enumSpecifier_AST; - } - - public final void typedefName() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode typedefName_AST = null; - Token i = null; - TNode i_AST = null; - - try { // for error handling - if (!( isTypedefName ( LT(1).getText() ) )) - throw new SemanticException(" isTypedefName ( LT(1).getText() ) "); - i = LT(1); - i_AST = (TNode)astFactory.create(i); - astFactory.addASTChild(currentAST, i_AST); - match(ID); - if ( inputState.guessing==0 ) { - typedefName_AST = (TNode)currentAST.root; - typedefName_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NTypedefName)).add(i_AST)); - currentAST.root = typedefName_AST; - currentAST.child = typedefName_AST!=null &&typedefName_AST.getFirstChild()!=null ? - typedefName_AST.getFirstChild() : typedefName_AST; - currentAST.advanceChildToEnd(); - } - typedefName_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_18); - } else { - throw ex; - } - } - returnAST = typedefName_AST; - } - - public final void structOrUnion() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode structOrUnion_AST = null; - - try { // for error handling - switch ( LA(1)) { - case LITERAL_struct: - { - TNode tmp35_AST = null; - tmp35_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp35_AST); - match(LITERAL_struct); - structOrUnion_AST = (TNode)currentAST.root; - break; - } - case LITERAL_union: - { - TNode tmp36_AST = null; - tmp36_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp36_AST); - match(LITERAL_union); - structOrUnion_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_19); - } else { - throw ex; - } - } - returnAST = structOrUnion_AST; - } - - public final void structDeclarationList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode structDeclarationList_AST = null; - - try { // for error handling - { - int _cnt30=0; - _loop30: - do { - if ((_tokenSet_20.member(LA(1)))) { - structDeclaration(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - if ( _cnt30>=1 ) { break _loop30; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt30++; - } while (true); - } - structDeclarationList_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_21); - } else { - throw ex; - } - } - returnAST = structDeclarationList_AST; - } - - public final void structDeclaration() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode structDeclaration_AST = null; - - try { // for error handling - specifierQualifierList(); - astFactory.addASTChild(currentAST, returnAST); - structDeclaratorList(); - astFactory.addASTChild(currentAST, returnAST); - { - int _cnt33=0; - _loop33: - do { - if ((LA(1)==SEMI)) { - match(SEMI); - } - else { - if ( _cnt33>=1 ) { break _loop33; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt33++; - } while (true); - } - structDeclaration_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_22); - } else { - throw ex; - } - } - returnAST = structDeclaration_AST; - } - - public final void specifierQualifierList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode specifierQualifierList_AST = null; - int specCount = 0; - - try { // for error handling - { - int _cnt38=0; - _loop38: - do { - boolean synPredMatched37 = false; - if (((_tokenSet_13.member(LA(1))) && (_tokenSet_23.member(LA(2))))) { - int _m37 = mark(); - synPredMatched37 = true; - inputState.guessing++; - try { - { - if ((LA(1)==LITERAL_struct) && (true)) { - match(LITERAL_struct); - } - else if ((LA(1)==LITERAL_union) && (true)) { - match(LITERAL_union); - } - else if ((LA(1)==LITERAL_enum) && (true)) { - match(LITERAL_enum); - } - else if ((_tokenSet_13.member(LA(1))) && (true)) { - typeSpecifier(specCount); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - } - catch (RecognitionException pe) { - synPredMatched37 = false; - } - rewind(_m37); - inputState.guessing--; - } - if ( synPredMatched37 ) { - specCount=typeSpecifier(specCount); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((LA(1)==LITERAL_volatile||LA(1)==LITERAL_const)) { - typeQualifier(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - if ( _cnt38>=1 ) { break _loop38; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt38++; - } while (true); - } - specifierQualifierList_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_24); - } else { - throw ex; - } - } - returnAST = specifierQualifierList_AST; - } - - public final void structDeclaratorList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode structDeclaratorList_AST = null; - - try { // for error handling - structDeclarator(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop41: - do { - if ((LA(1)==COMMA)) { - match(COMMA); - structDeclarator(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop41; - } - - } while (true); - } - structDeclaratorList_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_16); - } else { - throw ex; - } - } - returnAST = structDeclaratorList_AST; - } - - public final void structDeclarator() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode structDeclarator_AST = null; - - try { // for error handling - { - switch ( LA(1)) { - case COLON: - { - TNode tmp39_AST = null; - tmp39_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp39_AST); - match(COLON); - constExpr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case ID: - case STAR: - case LPAREN: - { - declarator(false); - astFactory.addASTChild(currentAST, returnAST); - { - switch ( LA(1)) { - case COLON: - { - TNode tmp40_AST = null; - tmp40_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp40_AST); - match(COLON); - constExpr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case SEMI: - case COMMA: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState.guessing==0 ) { - structDeclarator_AST = (TNode)currentAST.root; - structDeclarator_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NStructDeclarator)).add(structDeclarator_AST)); - currentAST.root = structDeclarator_AST; - currentAST.child = structDeclarator_AST!=null &&structDeclarator_AST.getFirstChild()!=null ? - structDeclarator_AST.getFirstChild() : structDeclarator_AST; - currentAST.advanceChildToEnd(); - } - structDeclarator_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_25); - } else { - throw ex; - } - } - returnAST = structDeclarator_AST; - } - - public final void constExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode constExpr_AST = null; - - try { // for error handling - conditionalExpr(); - astFactory.addASTChild(currentAST, returnAST); - constExpr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_26); - } else { - throw ex; - } - } - returnAST = constExpr_AST; - } - - public final String declarator( - boolean isFunctionDefinition - ) throws RecognitionException, TokenStreamException { - String declName; - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode declarator_AST = null; - Token id = null; - TNode id_AST = null; - TNode p_AST = null; - TNode i_AST = null; - declName = ""; - - try { // for error handling - { - switch ( LA(1)) { - case STAR: - { - pointerGroup(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case ID: - case LPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case ID: - { - id = LT(1); - id_AST = (TNode)astFactory.create(id); - astFactory.addASTChild(currentAST, id_AST); - match(ID); - if ( inputState.guessing==0 ) { - declName = id.getText(); - } - break; - } - case LPAREN: - { - TNode tmp41_AST = null; - tmp41_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp41_AST); - match(LPAREN); - declName=declarator(false); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp42_AST = null; - tmp42_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp42_AST); - match(RPAREN); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - _loop82: - do { - switch ( LA(1)) { - case LPAREN: - { - TNode tmp43_AST = null; - tmp43_AST = (TNode)astFactory.create(LT(1)); - match(LPAREN); - if ( inputState.guessing==0 ) { - - if (isFunctionDefinition) { - pushScope(declName); - } - else { - pushScope("!"+declName); - } - - } - { - boolean synPredMatched79 = false; - if (((_tokenSet_2.member(LA(1))) && (_tokenSet_27.member(LA(2))))) { - int _m79 = mark(); - synPredMatched79 = true; - inputState.guessing++; - try { - { - declSpecifiers(); - } - } - catch (RecognitionException pe) { - synPredMatched79 = false; - } - rewind(_m79); - inputState.guessing--; - } - if ( synPredMatched79 ) { - parameterTypeList(); - p_AST = (TNode)returnAST; - if ( inputState.guessing==0 ) { - declarator_AST = (TNode)currentAST.root; - - declarator_AST = (TNode)astFactory.make( (new ASTArray(3)).add(null).add(declarator_AST).add((TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NParameterTypeList)).add(p_AST)))); - - currentAST.root = declarator_AST; - currentAST.child = declarator_AST!=null &&declarator_AST.getFirstChild()!=null ? - declarator_AST.getFirstChild() : declarator_AST; - currentAST.advanceChildToEnd(); - } - } - else if ((LA(1)==ID||LA(1)==RPAREN) && (_tokenSet_28.member(LA(2)))) { - { - switch ( LA(1)) { - case ID: - { - idList(); - i_AST = (TNode)returnAST; - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState.guessing==0 ) { - declarator_AST = (TNode)currentAST.root; - - declarator_AST = (TNode)astFactory.make( (new ASTArray(3)).add(null).add(declarator_AST).add((TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NParameterTypeList)).add(i_AST)))); - - currentAST.root = declarator_AST; - currentAST.child = declarator_AST!=null &&declarator_AST.getFirstChild()!=null ? - declarator_AST.getFirstChild() : declarator_AST; - currentAST.advanceChildToEnd(); - } - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - if ( inputState.guessing==0 ) { - - popScope(); - - } - TNode tmp44_AST = null; - tmp44_AST = (TNode)astFactory.create(LT(1)); - match(RPAREN); - break; - } - case LBRACKET: - { - TNode tmp45_AST = null; - tmp45_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp45_AST); - match(LBRACKET); - { - switch ( LA(1)) { - case ID: - case STAR: - case LPAREN: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case IntOctalConst: - case LongOctalConst: - case UnsignedOctalConst: - case IntIntConst: - case LongIntConst: - case UnsignedIntConst: - case IntHexConst: - case LongHexConst: - case UnsignedHexConst: - case FloatDoubleConst: - case DoubleDoubleConst: - case LongDoubleConst: - { - constExpr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RBRACKET: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp46_AST = null; - tmp46_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp46_AST); - match(RBRACKET); - break; - } - default: - { - break _loop82; - } - } - } while (true); - } - if ( inputState.guessing==0 ) { - declarator_AST = (TNode)currentAST.root; - declarator_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NDeclarator)).add(declarator_AST)); - currentAST.root = declarator_AST; - currentAST.child = declarator_AST!=null &&declarator_AST.getFirstChild()!=null ? - declarator_AST.getFirstChild() : declarator_AST; - currentAST.advanceChildToEnd(); - } - declarator_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_29); - } else { - throw ex; - } - } - returnAST = declarator_AST; - return declName; - } - - public final void enumList( - String enumName - ) throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode enumList_AST = null; - - try { // for error handling - enumerator(enumName); - astFactory.addASTChild(currentAST, returnAST); - { - _loop51: - do { - if ((LA(1)==COMMA)) { - match(COMMA); - enumerator(enumName); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop51; - } - - } while (true); - } - enumList_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_21); - } else { - throw ex; - } - } - returnAST = enumList_AST; - } - - public final void enumerator( - String enumName - ) throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode enumerator_AST = null; - Token i = null; - TNode i_AST = null; - - try { // for error handling - i = LT(1); - i_AST = (TNode)astFactory.create(i); - astFactory.addASTChild(currentAST, i_AST); - match(ID); - if ( inputState.guessing==0 ) { - symbolTable.add( i.getText(), - (TNode)astFactory.make( (new ASTArray(3)).add(null).add((TNode)astFactory.create(LITERAL_enum,"enum")).add((TNode)astFactory.create(ID,enumName))) - ); - - } - { - switch ( LA(1)) { - case ASSIGN: - { - TNode tmp48_AST = null; - tmp48_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp48_AST); - match(ASSIGN); - constExpr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RCURLY: - case COMMA: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - enumerator_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_30); - } else { - throw ex; - } - } - returnAST = enumerator_AST; - } - - public final void initDecl( - AST declarationSpecifiers - ) throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode initDecl_AST = null; - TNode d_AST = null; - String declName = ""; - - try { // for error handling - declName=declarator(false); - d_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - AST ds1, d1; - ds1 = astFactory.dupList(declarationSpecifiers); - d1 = astFactory.dupList(d_AST); - symbolTable.add(declName, (TNode)astFactory.make( (new ASTArray(3)).add(null).add(ds1).add(d1)) ); - - } - { - switch ( LA(1)) { - case ASSIGN: - { - TNode tmp49_AST = null; - tmp49_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp49_AST); - match(ASSIGN); - initializer(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case COLON: - { - TNode tmp50_AST = null; - tmp50_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp50_AST); - match(COLON); - expr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case SEMI: - case COMMA: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState.guessing==0 ) { - initDecl_AST = (TNode)currentAST.root; - initDecl_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NInitDecl)).add(initDecl_AST)); - currentAST.root = initDecl_AST; - currentAST.child = initDecl_AST!=null &&initDecl_AST.getFirstChild()!=null ? - initDecl_AST.getFirstChild() : initDecl_AST; - currentAST.advanceChildToEnd(); - } - initDecl_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_25); - } else { - throw ex; - } - } - returnAST = initDecl_AST; - } - - public final void initializer() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode initializer_AST = null; - - try { // for error handling - { - switch ( LA(1)) { - case ID: - case STAR: - case LPAREN: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case IntOctalConst: - case LongOctalConst: - case UnsignedOctalConst: - case IntIntConst: - case LongIntConst: - case UnsignedIntConst: - case IntHexConst: - case LongHexConst: - case UnsignedHexConst: - case FloatDoubleConst: - case DoubleDoubleConst: - case LongDoubleConst: - { - assignExpr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LCURLY: - { - TNode tmp51_AST = null; - tmp51_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp51_AST); - match(LCURLY); - initializerList(); - astFactory.addASTChild(currentAST, returnAST); - { - switch ( LA(1)) { - case COMMA: - { - match(COMMA); - break; - } - case RCURLY: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - match(RCURLY); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState.guessing==0 ) { - initializer_AST = (TNode)currentAST.root; - initializer_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NInitializer)).add(initializer_AST)); - currentAST.root = initializer_AST; - currentAST.child = initializer_AST!=null &&initializer_AST.getFirstChild()!=null ? - initializer_AST.getFirstChild() : initializer_AST; - currentAST.advanceChildToEnd(); - } - initializer_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_31); - } else { - throw ex; - } - } - returnAST = initializer_AST; - } - - public final void pointerGroup() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode pointerGroup_AST = null; - - try { // for error handling - { - int _cnt63=0; - _loop63: - do { - if ((LA(1)==STAR)) { - TNode tmp54_AST = null; - tmp54_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp54_AST); - match(STAR); - { - _loop62: - do { - if ((LA(1)==LITERAL_volatile||LA(1)==LITERAL_const)) { - typeQualifier(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop62; - } - - } while (true); - } - } - else { - if ( _cnt63>=1 ) { break _loop63; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt63++; - } while (true); - } - if ( inputState.guessing==0 ) { - pointerGroup_AST = (TNode)currentAST.root; - pointerGroup_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NPointerGroup)).add(pointerGroup_AST)); - currentAST.root = pointerGroup_AST; - currentAST.child = pointerGroup_AST!=null &&pointerGroup_AST.getFirstChild()!=null ? - pointerGroup_AST.getFirstChild() : pointerGroup_AST; - currentAST.advanceChildToEnd(); - } - pointerGroup_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_32); - } else { - throw ex; - } - } - returnAST = pointerGroup_AST; - } - - public final void idList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode idList_AST = null; - - try { // for error handling - TNode tmp55_AST = null; - tmp55_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp55_AST); - match(ID); - { - _loop66: - do { - if ((LA(1)==COMMA)) { - match(COMMA); - TNode tmp57_AST = null; - tmp57_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp57_AST); - match(ID); - } - else { - break _loop66; - } - - } while (true); - } - idList_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_33); - } else { - throw ex; - } - } - returnAST = idList_AST; - } - - public final void assignExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode assignExpr_AST = null; - TNode a_AST = null; - - try { // for error handling - conditionalExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - switch ( LA(1)) { - case ASSIGN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - { - assignOperator(); - a_AST = (TNode)returnAST; - assignExpr(); - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - assignExpr_AST = (TNode)currentAST.root; - assignExpr_AST = (TNode)astFactory.make( (new ASTArray(2)).add(a_AST).add(assignExpr_AST)); - currentAST.root = assignExpr_AST; - currentAST.child = assignExpr_AST!=null &&assignExpr_AST.getFirstChild()!=null ? - assignExpr_AST.getFirstChild() : assignExpr_AST; - currentAST.advanceChildToEnd(); - } - break; - } - case RCURLY: - case SEMI: - case COMMA: - case COLON: - case RPAREN: - case RBRACKET: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - assignExpr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_12); - } else { - throw ex; - } - } - returnAST = assignExpr_AST; - } - - public final void initializerList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode initializerList_AST = null; - - try { // for error handling - initializer(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop72: - do { - if ((LA(1)==COMMA) && (_tokenSet_34.member(LA(2)))) { - match(COMMA); - initializer(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop72; - } - - } while (true); - } - initializerList_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_30); - } else { - throw ex; - } - } - returnAST = initializerList_AST; - } - - public final void parameterTypeList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode parameterTypeList_AST = null; - - try { // for error handling - parameterDeclaration(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop85: - do { - if ((LA(1)==COMMA) && (_tokenSet_2.member(LA(2)))) { - match(COMMA); - parameterDeclaration(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop85; - } - - } while (true); - } - { - switch ( LA(1)) { - case COMMA: - { - match(COMMA); - TNode tmp61_AST = null; - tmp61_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp61_AST); - match(VARARGS); - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - parameterTypeList_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_33); - } else { - throw ex; - } - } - returnAST = parameterTypeList_AST; - } - - public final void parameterDeclaration() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode parameterDeclaration_AST = null; - TNode ds_AST = null; - TNode d_AST = null; - String declName; - - try { // for error handling - declSpecifiers(); - ds_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - { - boolean synPredMatched90 = false; - if (((_tokenSet_10.member(LA(1))) && (_tokenSet_35.member(LA(2))))) { - int _m90 = mark(); - synPredMatched90 = true; - inputState.guessing++; - try { - { - declarator(false); - } - } - catch (RecognitionException pe) { - synPredMatched90 = false; - } - rewind(_m90); - inputState.guessing--; - } - if ( synPredMatched90 ) { - declName=declarator(false); - d_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - - AST d2, ds2; - d2 = astFactory.dupList(d_AST); - ds2 = astFactory.dupList(ds_AST); - symbolTable.add(declName, (TNode)astFactory.make( (new ASTArray(3)).add(null).add(ds2).add(d2))); - - } - } - else if ((_tokenSet_36.member(LA(1))) && (_tokenSet_37.member(LA(2)))) { - nonemptyAbstractDeclarator(); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((LA(1)==COMMA||LA(1)==RPAREN)) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - if ( inputState.guessing==0 ) { - parameterDeclaration_AST = (TNode)currentAST.root; - - parameterDeclaration_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NParameterDeclaration)).add(parameterDeclaration_AST)); - - currentAST.root = parameterDeclaration_AST; - currentAST.child = parameterDeclaration_AST!=null &¶meterDeclaration_AST.getFirstChild()!=null ? - parameterDeclaration_AST.getFirstChild() : parameterDeclaration_AST; - currentAST.advanceChildToEnd(); - } - parameterDeclaration_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_38); - } else { - throw ex; - } - } - returnAST = parameterDeclaration_AST; - } - - public final void nonemptyAbstractDeclarator() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode nonemptyAbstractDeclarator_AST = null; - - try { // for error handling - { - switch ( LA(1)) { - case STAR: - { - pointerGroup(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop184: - do { - switch ( LA(1)) { - case LPAREN: - { - { - TNode tmp62_AST = null; - tmp62_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp62_AST); - match(LPAREN); - { - switch ( LA(1)) { - case STAR: - case LPAREN: - case LBRACKET: - { - nonemptyAbstractDeclarator(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LITERAL_typedef: - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_auto: - case LITERAL_register: - case LITERAL_extern: - case LITERAL_static: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case ID: - { - parameterTypeList(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp63_AST = null; - tmp63_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp63_AST); - match(RPAREN); - } - break; - } - case LBRACKET: - { - { - TNode tmp64_AST = null; - tmp64_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp64_AST); - match(LBRACKET); - { - switch ( LA(1)) { - case ID: - case STAR: - case LPAREN: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case IntOctalConst: - case LongOctalConst: - case UnsignedOctalConst: - case IntIntConst: - case LongIntConst: - case UnsignedIntConst: - case IntHexConst: - case LongHexConst: - case UnsignedHexConst: - case FloatDoubleConst: - case DoubleDoubleConst: - case LongDoubleConst: - { - expr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RBRACKET: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp65_AST = null; - tmp65_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp65_AST); - match(RBRACKET); - } - break; - } - default: - { - break _loop184; - } - } - } while (true); - } - break; - } - case LPAREN: - case LBRACKET: - { - { - int _cnt190=0; - _loop190: - do { - switch ( LA(1)) { - case LPAREN: - { - { - TNode tmp66_AST = null; - tmp66_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp66_AST); - match(LPAREN); - { - switch ( LA(1)) { - case STAR: - case LPAREN: - case LBRACKET: - { - nonemptyAbstractDeclarator(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LITERAL_typedef: - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_auto: - case LITERAL_register: - case LITERAL_extern: - case LITERAL_static: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case ID: - { - parameterTypeList(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp67_AST = null; - tmp67_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp67_AST); - match(RPAREN); - } - break; - } - case LBRACKET: - { - { - TNode tmp68_AST = null; - tmp68_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp68_AST); - match(LBRACKET); - { - switch ( LA(1)) { - case ID: - case STAR: - case LPAREN: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case IntOctalConst: - case LongOctalConst: - case UnsignedOctalConst: - case IntIntConst: - case LongIntConst: - case UnsignedIntConst: - case IntHexConst: - case LongHexConst: - case UnsignedHexConst: - case FloatDoubleConst: - case DoubleDoubleConst: - case LongDoubleConst: - { - expr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RBRACKET: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp69_AST = null; - tmp69_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp69_AST); - match(RBRACKET); - } - break; - } - default: - { - if ( _cnt190>=1 ) { break _loop190; } else {throw new NoViableAltException(LT(1), getFilename());} - } - } - _cnt190++; - } while (true); - } - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState.guessing==0 ) { - nonemptyAbstractDeclarator_AST = (TNode)currentAST.root; - nonemptyAbstractDeclarator_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NNonemptyAbstractDeclarator)).add(nonemptyAbstractDeclarator_AST)); - currentAST.root = nonemptyAbstractDeclarator_AST; - currentAST.child = nonemptyAbstractDeclarator_AST!=null &&nonemptyAbstractDeclarator_AST.getFirstChild()!=null ? - nonemptyAbstractDeclarator_AST.getFirstChild() : nonemptyAbstractDeclarator_AST; - currentAST.advanceChildToEnd(); - } - nonemptyAbstractDeclarator_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_38); - } else { - throw ex; - } - } - returnAST = nonemptyAbstractDeclarator_AST; - } - - public final void functionDeclSpecifiers() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode functionDeclSpecifiers_AST = null; - int specCount = 0; - - try { // for error handling - { - int _cnt104=0; - _loop104: - do { - switch ( LA(1)) { - case LITERAL_extern: - case LITERAL_static: - { - functionStorageClassSpecifier(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LITERAL_volatile: - case LITERAL_const: - { - typeQualifier(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - default: - boolean synPredMatched103 = false; - if (((_tokenSet_13.member(LA(1))) && (_tokenSet_9.member(LA(2))))) { - int _m103 = mark(); - synPredMatched103 = true; - inputState.guessing++; - try { - { - if ((LA(1)==LITERAL_struct) && (true)) { - match(LITERAL_struct); - } - else if ((LA(1)==LITERAL_union) && (true)) { - match(LITERAL_union); - } - else if ((LA(1)==LITERAL_enum) && (true)) { - match(LITERAL_enum); - } - else if ((_tokenSet_13.member(LA(1))) && (true)) { - typeSpecifier(specCount); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - } - catch (RecognitionException pe) { - synPredMatched103 = false; - } - rewind(_m103); - inputState.guessing--; - } - if ( synPredMatched103 ) { - specCount=typeSpecifier(specCount); - astFactory.addASTChild(currentAST, returnAST); - } - else { - if ( _cnt104>=1 ) { break _loop104; } else {throw new NoViableAltException(LT(1), getFilename());} - } - } - _cnt104++; - } while (true); - } - functionDeclSpecifiers_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_10); - } else { - throw ex; - } - } - returnAST = functionDeclSpecifiers_AST; - } - - public final void compoundStatement( - String scopeName - ) throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode compoundStatement_AST = null; - - try { // for error handling - match(LCURLY); - if ( inputState.guessing==0 ) { - - pushScope(scopeName); - - } - { - boolean synPredMatched115 = false; - if (((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2))))) { - int _m115 = mark(); - synPredMatched115 = true; - inputState.guessing++; - try { - { - declarationPredictor(); - } - } - catch (RecognitionException pe) { - synPredMatched115 = false; - } - rewind(_m115); - inputState.guessing--; - } - if ( synPredMatched115 ) { - declarationList(); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_39.member(LA(1))) && (_tokenSet_40.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - { - switch ( LA(1)) { - case LCURLY: - case SEMI: - case ID: - case STAR: - case LPAREN: - case LITERAL_while: - case LITERAL_do: - case LITERAL_for: - case LITERAL_goto: - case LITERAL_continue: - case LITERAL_break: - case LITERAL_return: - case LITERAL_case: - case LITERAL_default: - case LITERAL_if: - case LITERAL_switch: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case IntOctalConst: - case LongOctalConst: - case UnsignedOctalConst: - case IntIntConst: - case LongIntConst: - case UnsignedIntConst: - case IntHexConst: - case LongHexConst: - case UnsignedHexConst: - case FloatDoubleConst: - case DoubleDoubleConst: - case LongDoubleConst: - { - statementList(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RCURLY: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState.guessing==0 ) { - popScope(); - } - match(RCURLY); - if ( inputState.guessing==0 ) { - compoundStatement_AST = (TNode)currentAST.root; - compoundStatement_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NCompoundStatement,scopeName)).add(compoundStatement_AST)); - currentAST.root = compoundStatement_AST; - currentAST.child = compoundStatement_AST!=null &&compoundStatement_AST.getFirstChild()!=null ? - compoundStatement_AST.getFirstChild() : compoundStatement_AST; - currentAST.advanceChildToEnd(); - } - compoundStatement_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_41); - } else { - throw ex; - } - } - returnAST = compoundStatement_AST; - } - - public final void declarationList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode declarationList_AST = null; - - try { // for error handling - { - int _cnt109=0; - _loop109: - do { - boolean synPredMatched108 = false; - if (((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2))))) { - int _m108 = mark(); - synPredMatched108 = true; - inputState.guessing++; - try { - { - declarationPredictor(); - } - } - catch (RecognitionException pe) { - synPredMatched108 = false; - } - rewind(_m108); - inputState.guessing--; - } - if ( synPredMatched108 ) { - declaration(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - if ( _cnt109>=1 ) { break _loop109; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt109++; - } while (true); - } - declarationList_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_39); - } else { - throw ex; - } - } - returnAST = declarationList_AST; - } - - public final void declarationPredictor() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode declarationPredictor_AST = null; - - try { // for error handling - { - if ((LA(1)==LITERAL_typedef) && (LA(2)==EOF)) { - TNode tmp72_AST = null; - tmp72_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp72_AST); - match(LITERAL_typedef); - } - else if ((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2)))) { - declaration(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - declarationPredictor_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_0); - } else { - throw ex; - } - } - returnAST = declarationPredictor_AST; - } - - public final void statementList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode statementList_AST = null; - - try { // for error handling - { - int _cnt119=0; - _loop119: - do { - if ((_tokenSet_42.member(LA(1)))) { - statement(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - if ( _cnt119>=1 ) { break _loop119; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt119++; - } while (true); - } - statementList_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_21); - } else { - throw ex; - } - } - returnAST = statementList_AST; - } - - public final void statement() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode statement_AST = null; - TNode e1_AST = null; - TNode e2_AST = null; - TNode e3_AST = null; - TNode s_AST = null; - - try { // for error handling - switch ( LA(1)) { - case SEMI: - { - TNode tmp73_AST = null; - tmp73_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp73_AST); - match(SEMI); - statement_AST = (TNode)currentAST.root; - break; - } - case LCURLY: - { - compoundStatement(getAScopeName()); - astFactory.addASTChild(currentAST, returnAST); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_while: - { - TNode tmp74_AST = null; - tmp74_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp74_AST); - match(LITERAL_while); - match(LPAREN); - expr(); - astFactory.addASTChild(currentAST, returnAST); - match(RPAREN); - statement(); - astFactory.addASTChild(currentAST, returnAST); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_do: - { - TNode tmp77_AST = null; - tmp77_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp77_AST); - match(LITERAL_do); - statement(); - astFactory.addASTChild(currentAST, returnAST); - match(LITERAL_while); - match(LPAREN); - expr(); - astFactory.addASTChild(currentAST, returnAST); - match(RPAREN); - match(SEMI); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_for: - { - match(LITERAL_for); - TNode tmp83_AST = null; - tmp83_AST = (TNode)astFactory.create(LT(1)); - match(LPAREN); - { - switch ( LA(1)) { - case ID: - case STAR: - case LPAREN: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case IntOctalConst: - case LongOctalConst: - case UnsignedOctalConst: - case IntIntConst: - case LongIntConst: - case UnsignedIntConst: - case IntHexConst: - case LongHexConst: - case UnsignedHexConst: - case FloatDoubleConst: - case DoubleDoubleConst: - case LongDoubleConst: - { - expr(); - e1_AST = (TNode)returnAST; - break; - } - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp84_AST = null; - tmp84_AST = (TNode)astFactory.create(LT(1)); - match(SEMI); - { - switch ( LA(1)) { - case ID: - case STAR: - case LPAREN: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case IntOctalConst: - case LongOctalConst: - case UnsignedOctalConst: - case IntIntConst: - case LongIntConst: - case UnsignedIntConst: - case IntHexConst: - case LongHexConst: - case UnsignedHexConst: - case FloatDoubleConst: - case DoubleDoubleConst: - case LongDoubleConst: - { - expr(); - e2_AST = (TNode)returnAST; - break; - } - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp85_AST = null; - tmp85_AST = (TNode)astFactory.create(LT(1)); - match(SEMI); - { - switch ( LA(1)) { - case ID: - case STAR: - case LPAREN: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case IntOctalConst: - case LongOctalConst: - case UnsignedOctalConst: - case IntIntConst: - case LongIntConst: - case UnsignedIntConst: - case IntHexConst: - case LongHexConst: - case UnsignedHexConst: - case FloatDoubleConst: - case DoubleDoubleConst: - case LongDoubleConst: - { - expr(); - e3_AST = (TNode)returnAST; - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp86_AST = null; - tmp86_AST = (TNode)astFactory.create(LT(1)); - match(RPAREN); - statement(); - s_AST = (TNode)returnAST; - if ( inputState.guessing==0 ) { - statement_AST = (TNode)currentAST.root; - - if ( e1_AST == null) { e1_AST = (TNode)astFactory.create(NEmptyExpression); } - if ( e2_AST == null) { e2_AST = (TNode)astFactory.create(NEmptyExpression); } - if ( e3_AST == null) { e3_AST = (TNode)astFactory.create(NEmptyExpression); } - statement_AST = (TNode)astFactory.make( (new ASTArray(5)).add((TNode)astFactory.create(LITERAL_for,"for")).add(e1_AST).add(e2_AST).add(e3_AST).add(s_AST)); - - currentAST.root = statement_AST; - currentAST.child = statement_AST!=null &&statement_AST.getFirstChild()!=null ? - statement_AST.getFirstChild() : statement_AST; - currentAST.advanceChildToEnd(); - } - break; - } - case LITERAL_goto: - { - TNode tmp87_AST = null; - tmp87_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp87_AST); - match(LITERAL_goto); - TNode tmp88_AST = null; - tmp88_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp88_AST); - match(ID); - match(SEMI); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_continue: - { - TNode tmp90_AST = null; - tmp90_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp90_AST); - match(LITERAL_continue); - match(SEMI); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_break: - { - TNode tmp92_AST = null; - tmp92_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp92_AST); - match(LITERAL_break); - match(SEMI); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_return: - { - TNode tmp94_AST = null; - tmp94_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp94_AST); - match(LITERAL_return); - { - switch ( LA(1)) { - case ID: - case STAR: - case LPAREN: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case IntOctalConst: - case LongOctalConst: - case UnsignedOctalConst: - case IntIntConst: - case LongIntConst: - case UnsignedIntConst: - case IntHexConst: - case LongHexConst: - case UnsignedHexConst: - case FloatDoubleConst: - case DoubleDoubleConst: - case LongDoubleConst: - { - expr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - match(SEMI); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_case: - { - TNode tmp96_AST = null; - tmp96_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp96_AST); - match(LITERAL_case); - constExpr(); - astFactory.addASTChild(currentAST, returnAST); - match(COLON); - statement(); - astFactory.addASTChild(currentAST, returnAST); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_default: - { - TNode tmp98_AST = null; - tmp98_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp98_AST); - match(LITERAL_default); - match(COLON); - statement(); - astFactory.addASTChild(currentAST, returnAST); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_if: - { - TNode tmp100_AST = null; - tmp100_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp100_AST); - match(LITERAL_if); - match(LPAREN); - expr(); - astFactory.addASTChild(currentAST, returnAST); - match(RPAREN); - statement(); - astFactory.addASTChild(currentAST, returnAST); - { - if ((LA(1)==LITERAL_else) && (_tokenSet_42.member(LA(2)))) { - TNode tmp103_AST = null; - tmp103_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp103_AST); - match(LITERAL_else); - statement(); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_43.member(LA(1))) && (_tokenSet_40.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_switch: - { - TNode tmp104_AST = null; - tmp104_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp104_AST); - match(LITERAL_switch); - match(LPAREN); - expr(); - astFactory.addASTChild(currentAST, returnAST); - match(RPAREN); - statement(); - astFactory.addASTChild(currentAST, returnAST); - statement_AST = (TNode)currentAST.root; - break; - } - default: - if ((_tokenSet_11.member(LA(1))) && (_tokenSet_44.member(LA(2)))) { - expr(); - astFactory.addASTChild(currentAST, returnAST); - match(SEMI); - if ( inputState.guessing==0 ) { - statement_AST = (TNode)currentAST.root; - statement_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NStatementExpr)).add(statement_AST)); - currentAST.root = statement_AST; - currentAST.child = statement_AST!=null &&statement_AST.getFirstChild()!=null ? - statement_AST.getFirstChild() : statement_AST; - currentAST.advanceChildToEnd(); - } - statement_AST = (TNode)currentAST.root; - } - else if ((LA(1)==ID) && (LA(2)==COLON)) { - TNode tmp108_AST = null; - tmp108_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp108_AST); - match(ID); - match(COLON); - { - if ((_tokenSet_42.member(LA(1))) && (_tokenSet_45.member(LA(2)))) { - statement(); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_43.member(LA(1))) && (_tokenSet_40.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - if ( inputState.guessing==0 ) { - statement_AST = (TNode)currentAST.root; - statement_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NLabel)).add(statement_AST)); - currentAST.root = statement_AST; - currentAST.child = statement_AST!=null &&statement_AST.getFirstChild()!=null ? - statement_AST.getFirstChild() : statement_AST; - currentAST.advanceChildToEnd(); - } - statement_AST = (TNode)currentAST.root; - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_43); - } else { - throw ex; - } - } - returnAST = statement_AST; - } - - public final void conditionalExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode conditionalExpr_AST = null; - - try { // for error handling - logicalOrExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - switch ( LA(1)) { - case QUESTION: - { - TNode tmp110_AST = null; - tmp110_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp110_AST); - match(QUESTION); - expr(); - astFactory.addASTChild(currentAST, returnAST); - match(COLON); - conditionalExpr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RCURLY: - case SEMI: - case COMMA: - case COLON: - case ASSIGN: - case RPAREN: - case RBRACKET: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - conditionalExpr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_46); - } else { - throw ex; - } - } - returnAST = conditionalExpr_AST; - } - - public final void assignOperator() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode assignOperator_AST = null; - - try { // for error handling - switch ( LA(1)) { - case ASSIGN: - { - TNode tmp112_AST = null; - tmp112_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp112_AST); - match(ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case DIV_ASSIGN: - { - TNode tmp113_AST = null; - tmp113_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp113_AST); - match(DIV_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case PLUS_ASSIGN: - { - TNode tmp114_AST = null; - tmp114_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp114_AST); - match(PLUS_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case MINUS_ASSIGN: - { - TNode tmp115_AST = null; - tmp115_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp115_AST); - match(MINUS_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case STAR_ASSIGN: - { - TNode tmp116_AST = null; - tmp116_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp116_AST); - match(STAR_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case MOD_ASSIGN: - { - TNode tmp117_AST = null; - tmp117_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp117_AST); - match(MOD_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case RSHIFT_ASSIGN: - { - TNode tmp118_AST = null; - tmp118_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp118_AST); - match(RSHIFT_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case LSHIFT_ASSIGN: - { - TNode tmp119_AST = null; - tmp119_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp119_AST); - match(LSHIFT_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case BAND_ASSIGN: - { - TNode tmp120_AST = null; - tmp120_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp120_AST); - match(BAND_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case BOR_ASSIGN: - { - TNode tmp121_AST = null; - tmp121_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp121_AST); - match(BOR_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case BXOR_ASSIGN: - { - TNode tmp122_AST = null; - tmp122_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp122_AST); - match(BXOR_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_11); - } else { - throw ex; - } - } - returnAST = assignOperator_AST; - } - - public final void logicalOrExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode logicalOrExpr_AST = null; - - try { // for error handling - logicalAndExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop138: - do { - if ((LA(1)==LOR)) { - TNode tmp123_AST = null; - tmp123_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp123_AST); - match(LOR); - logicalAndExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop138; - } - - } while (true); - } - logicalOrExpr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_47); - } else { - throw ex; - } - } - returnAST = logicalOrExpr_AST; - } - - public final void logicalAndExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode logicalAndExpr_AST = null; - - try { // for error handling - inclusiveOrExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop141: - do { - if ((LA(1)==LAND)) { - TNode tmp124_AST = null; - tmp124_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp124_AST); - match(LAND); - inclusiveOrExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop141; - } - - } while (true); - } - logicalAndExpr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_48); - } else { - throw ex; - } - } - returnAST = logicalAndExpr_AST; - } - - public final void inclusiveOrExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode inclusiveOrExpr_AST = null; - - try { // for error handling - exclusiveOrExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop144: - do { - if ((LA(1)==BOR)) { - TNode tmp125_AST = null; - tmp125_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp125_AST); - match(BOR); - exclusiveOrExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop144; - } - - } while (true); - } - inclusiveOrExpr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_49); - } else { - throw ex; - } - } - returnAST = inclusiveOrExpr_AST; - } - - public final void exclusiveOrExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode exclusiveOrExpr_AST = null; - - try { // for error handling - bitAndExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop147: - do { - if ((LA(1)==BXOR)) { - TNode tmp126_AST = null; - tmp126_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp126_AST); - match(BXOR); - bitAndExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop147; - } - - } while (true); - } - exclusiveOrExpr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_50); - } else { - throw ex; - } - } - returnAST = exclusiveOrExpr_AST; - } - - public final void bitAndExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode bitAndExpr_AST = null; - - try { // for error handling - equalityExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop150: - do { - if ((LA(1)==BAND)) { - TNode tmp127_AST = null; - tmp127_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp127_AST); - match(BAND); - equalityExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop150; - } - - } while (true); - } - bitAndExpr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_51); - } else { - throw ex; - } - } - returnAST = bitAndExpr_AST; - } - - public final void equalityExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode equalityExpr_AST = null; - - try { // for error handling - relationalExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop154: - do { - if ((LA(1)==EQUAL||LA(1)==NOT_EQUAL)) { - { - switch ( LA(1)) { - case EQUAL: - { - TNode tmp128_AST = null; - tmp128_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp128_AST); - match(EQUAL); - break; - } - case NOT_EQUAL: - { - TNode tmp129_AST = null; - tmp129_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp129_AST); - match(NOT_EQUAL); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - relationalExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop154; - } - - } while (true); - } - equalityExpr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_52); - } else { - throw ex; - } - } - returnAST = equalityExpr_AST; - } - - public final void relationalExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode relationalExpr_AST = null; - - try { // for error handling - shiftExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop158: - do { - if (((LA(1) >= LT && LA(1) <= GTE))) { - { - switch ( LA(1)) { - case LT: - { - TNode tmp130_AST = null; - tmp130_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp130_AST); - match(LT); - break; - } - case LTE: - { - TNode tmp131_AST = null; - tmp131_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp131_AST); - match(LTE); - break; - } - case GT: - { - TNode tmp132_AST = null; - tmp132_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp132_AST); - match(GT); - break; - } - case GTE: - { - TNode tmp133_AST = null; - tmp133_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp133_AST); - match(GTE); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - shiftExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop158; - } - - } while (true); - } - relationalExpr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_53); - } else { - throw ex; - } - } - returnAST = relationalExpr_AST; - } - - public final void shiftExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode shiftExpr_AST = null; - - try { // for error handling - additiveExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop162: - do { - if ((LA(1)==LSHIFT||LA(1)==RSHIFT)) { - { - switch ( LA(1)) { - case LSHIFT: - { - TNode tmp134_AST = null; - tmp134_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp134_AST); - match(LSHIFT); - break; - } - case RSHIFT: - { - TNode tmp135_AST = null; - tmp135_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp135_AST); - match(RSHIFT); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - additiveExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop162; - } - - } while (true); - } - shiftExpr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_54); - } else { - throw ex; - } - } - returnAST = shiftExpr_AST; - } - - public final void additiveExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode additiveExpr_AST = null; - - try { // for error handling - multExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop166: - do { - if ((LA(1)==PLUS||LA(1)==MINUS)) { - { - switch ( LA(1)) { - case PLUS: - { - TNode tmp136_AST = null; - tmp136_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp136_AST); - match(PLUS); - break; - } - case MINUS: - { - TNode tmp137_AST = null; - tmp137_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp137_AST); - match(MINUS); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - multExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop166; - } - - } while (true); - } - additiveExpr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_55); - } else { - throw ex; - } - } - returnAST = additiveExpr_AST; - } - - public final void multExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode multExpr_AST = null; - - try { // for error handling - castExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop170: - do { - if ((_tokenSet_56.member(LA(1)))) { - { - switch ( LA(1)) { - case STAR: - { - TNode tmp138_AST = null; - tmp138_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp138_AST); - match(STAR); - break; - } - case DIV: - { - TNode tmp139_AST = null; - tmp139_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp139_AST); - match(DIV); - break; - } - case MOD: - { - TNode tmp140_AST = null; - tmp140_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp140_AST); - match(MOD); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - castExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop170; - } - - } while (true); - } - multExpr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_57); - } else { - throw ex; - } - } - returnAST = multExpr_AST; - } - - public final void castExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode castExpr_AST = null; - - try { // for error handling - boolean synPredMatched173 = false; - if (((LA(1)==LPAREN) && (_tokenSet_20.member(LA(2))))) { - int _m173 = mark(); - synPredMatched173 = true; - inputState.guessing++; - try { - { - match(LPAREN); - typeName(); - match(RPAREN); - } - } - catch (RecognitionException pe) { - synPredMatched173 = false; - } - rewind(_m173); - inputState.guessing--; - } - if ( synPredMatched173 ) { - match(LPAREN); - typeName(); - astFactory.addASTChild(currentAST, returnAST); - match(RPAREN); - { - castExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - if ( inputState.guessing==0 ) { - castExpr_AST = (TNode)currentAST.root; - castExpr_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NCast,"(")).add(castExpr_AST)); - currentAST.root = castExpr_AST; - currentAST.child = castExpr_AST!=null &&castExpr_AST.getFirstChild()!=null ? - castExpr_AST.getFirstChild() : castExpr_AST; - currentAST.advanceChildToEnd(); - } - castExpr_AST = (TNode)currentAST.root; - } - else if ((_tokenSet_11.member(LA(1))) && (_tokenSet_58.member(LA(2)))) { - unaryExpr(); - astFactory.addASTChild(currentAST, returnAST); - castExpr_AST = (TNode)currentAST.root; - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_59); - } else { - throw ex; - } - } - returnAST = castExpr_AST; - } - - public final void typeName() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode typeName_AST = null; - - try { // for error handling - specifierQualifierList(); - astFactory.addASTChild(currentAST, returnAST); - { - switch ( LA(1)) { - case STAR: - case LPAREN: - case LBRACKET: - { - nonemptyAbstractDeclarator(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - typeName_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_33); - } else { - throw ex; - } - } - returnAST = typeName_AST; - } - - public final void unaryExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode unaryExpr_AST = null; - TNode u_AST = null; - - try { // for error handling - switch ( LA(1)) { - case ID: - case LPAREN: - case CharLiteral: - case StringLiteral: - case IntOctalConst: - case LongOctalConst: - case UnsignedOctalConst: - case IntIntConst: - case LongIntConst: - case UnsignedIntConst: - case IntHexConst: - case LongHexConst: - case UnsignedHexConst: - case FloatDoubleConst: - case DoubleDoubleConst: - case LongDoubleConst: - { - postfixExpr(); - astFactory.addASTChild(currentAST, returnAST); - unaryExpr_AST = (TNode)currentAST.root; - break; - } - case INC: - { - TNode tmp143_AST = null; - tmp143_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp143_AST); - match(INC); - unaryExpr(); - astFactory.addASTChild(currentAST, returnAST); - unaryExpr_AST = (TNode)currentAST.root; - break; - } - case DEC: - { - TNode tmp144_AST = null; - tmp144_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp144_AST); - match(DEC); - unaryExpr(); - astFactory.addASTChild(currentAST, returnAST); - unaryExpr_AST = (TNode)currentAST.root; - break; - } - case STAR: - case BAND: - case PLUS: - case MINUS: - case BNOT: - case LNOT: - { - unaryOperator(); - u_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - castExpr(); - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - unaryExpr_AST = (TNode)currentAST.root; - unaryExpr_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NUnaryExpr)).add(unaryExpr_AST)); - currentAST.root = unaryExpr_AST; - currentAST.child = unaryExpr_AST!=null &&unaryExpr_AST.getFirstChild()!=null ? - unaryExpr_AST.getFirstChild() : unaryExpr_AST; - currentAST.advanceChildToEnd(); - } - unaryExpr_AST = (TNode)currentAST.root; - break; - } - case LITERAL_sizeof: - { - TNode tmp145_AST = null; - tmp145_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp145_AST); - match(LITERAL_sizeof); - { - boolean synPredMatched194 = false; - if (((LA(1)==LPAREN) && (_tokenSet_20.member(LA(2))))) { - int _m194 = mark(); - synPredMatched194 = true; - inputState.guessing++; - try { - { - match(LPAREN); - typeName(); - } - } - catch (RecognitionException pe) { - synPredMatched194 = false; - } - rewind(_m194); - inputState.guessing--; - } - if ( synPredMatched194 ) { - TNode tmp146_AST = null; - tmp146_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp146_AST); - match(LPAREN); - typeName(); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp147_AST = null; - tmp147_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp147_AST); - match(RPAREN); - } - else if ((_tokenSet_11.member(LA(1))) && (_tokenSet_58.member(LA(2)))) { - unaryExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - unaryExpr_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_59); - } else { - throw ex; - } - } - returnAST = unaryExpr_AST; - } - - public final void postfixExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode postfixExpr_AST = null; - - try { // for error handling - primaryExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - switch ( LA(1)) { - case LPAREN: - case LBRACKET: - case INC: - case DEC: - case PTR: - case DOT: - { - postfixSuffix(); - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - postfixExpr_AST = (TNode)currentAST.root; - postfixExpr_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NPostfixExpr)).add(postfixExpr_AST)); - currentAST.root = postfixExpr_AST; - currentAST.child = postfixExpr_AST!=null &&postfixExpr_AST.getFirstChild()!=null ? - postfixExpr_AST.getFirstChild() : postfixExpr_AST; - currentAST.advanceChildToEnd(); - } - break; - } - case RCURLY: - case SEMI: - case COMMA: - case COLON: - case ASSIGN: - case STAR: - case RPAREN: - case RBRACKET: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - postfixExpr_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_59); - } else { - throw ex; - } - } - returnAST = postfixExpr_AST; - } - - public final void unaryOperator() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode unaryOperator_AST = null; - - try { // for error handling - switch ( LA(1)) { - case BAND: - { - TNode tmp148_AST = null; - tmp148_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp148_AST); - match(BAND); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - case STAR: - { - TNode tmp149_AST = null; - tmp149_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp149_AST); - match(STAR); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - case PLUS: - { - TNode tmp150_AST = null; - tmp150_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp150_AST); - match(PLUS); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - case MINUS: - { - TNode tmp151_AST = null; - tmp151_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp151_AST); - match(MINUS); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - case BNOT: - { - TNode tmp152_AST = null; - tmp152_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp152_AST); - match(BNOT); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - case LNOT: - { - TNode tmp153_AST = null; - tmp153_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp153_AST); - match(LNOT); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_11); - } else { - throw ex; - } - } - returnAST = unaryOperator_AST; - } - - public final void primaryExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode primaryExpr_AST = null; - - try { // for error handling - switch ( LA(1)) { - case ID: - { - TNode tmp154_AST = null; - tmp154_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp154_AST); - match(ID); - primaryExpr_AST = (TNode)currentAST.root; - break; - } - case CharLiteral: - { - charConst(); - astFactory.addASTChild(currentAST, returnAST); - primaryExpr_AST = (TNode)currentAST.root; - break; - } - case IntOctalConst: - case LongOctalConst: - case UnsignedOctalConst: - case IntIntConst: - case LongIntConst: - case UnsignedIntConst: - case IntHexConst: - case LongHexConst: - case UnsignedHexConst: - { - intConst(); - astFactory.addASTChild(currentAST, returnAST); - primaryExpr_AST = (TNode)currentAST.root; - break; - } - case FloatDoubleConst: - case DoubleDoubleConst: - case LongDoubleConst: - { - floatConst(); - astFactory.addASTChild(currentAST, returnAST); - primaryExpr_AST = (TNode)currentAST.root; - break; - } - case StringLiteral: - { - stringConst(); - astFactory.addASTChild(currentAST, returnAST); - primaryExpr_AST = (TNode)currentAST.root; - break; - } - case LPAREN: - { - match(LPAREN); - expr(); - astFactory.addASTChild(currentAST, returnAST); - match(RPAREN); - if ( inputState.guessing==0 ) { - primaryExpr_AST = (TNode)currentAST.root; - primaryExpr_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NExpressionGroup,"(")).add(primaryExpr_AST)); - currentAST.root = primaryExpr_AST; - currentAST.child = primaryExpr_AST!=null &&primaryExpr_AST.getFirstChild()!=null ? - primaryExpr_AST.getFirstChild() : primaryExpr_AST; - currentAST.advanceChildToEnd(); - } - primaryExpr_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_60); - } else { - throw ex; - } - } - returnAST = primaryExpr_AST; - } - - public final void postfixSuffix() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode postfixSuffix_AST = null; - - try { // for error handling - { - int _cnt200=0; - _loop200: - do { - switch ( LA(1)) { - case PTR: - { - TNode tmp157_AST = null; - tmp157_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp157_AST); - match(PTR); - TNode tmp158_AST = null; - tmp158_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp158_AST); - match(ID); - break; - } - case DOT: - { - TNode tmp159_AST = null; - tmp159_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp159_AST); - match(DOT); - TNode tmp160_AST = null; - tmp160_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp160_AST); - match(ID); - break; - } - case LPAREN: - { - functionCall(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LBRACKET: - { - TNode tmp161_AST = null; - tmp161_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp161_AST); - match(LBRACKET); - expr(); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp162_AST = null; - tmp162_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp162_AST); - match(RBRACKET); - break; - } - case INC: - { - TNode tmp163_AST = null; - tmp163_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp163_AST); - match(INC); - break; - } - case DEC: - { - TNode tmp164_AST = null; - tmp164_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp164_AST); - match(DEC); - break; - } - default: - { - if ( _cnt200>=1 ) { break _loop200; } else {throw new NoViableAltException(LT(1), getFilename());} - } - } - _cnt200++; - } while (true); - } - postfixSuffix_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_59); - } else { - throw ex; - } - } - returnAST = postfixSuffix_AST; - } - - public final void functionCall() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode functionCall_AST = null; - TNode a_AST = null; - - try { // for error handling - TNode tmp165_AST = null; - tmp165_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp165_AST); - match(LPAREN); - { - switch ( LA(1)) { - case ID: - case STAR: - case LPAREN: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case IntOctalConst: - case LongOctalConst: - case UnsignedOctalConst: - case IntIntConst: - case LongIntConst: - case UnsignedIntConst: - case IntHexConst: - case LongHexConst: - case UnsignedHexConst: - case FloatDoubleConst: - case DoubleDoubleConst: - case LongDoubleConst: - { - argExprList(); - a_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp166_AST = null; - tmp166_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp166_AST); - match(RPAREN); - if ( inputState.guessing==0 ) { - functionCall_AST = (TNode)currentAST.root; - - functionCall_AST.setType( NFunctionCallArgs ); - - } - functionCall_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_60); - } else { - throw ex; - } - } - returnAST = functionCall_AST; - } - - public final void argExprList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode argExprList_AST = null; - - try { // for error handling - assignExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop206: - do { - if ((LA(1)==COMMA)) { - match(COMMA); - assignExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop206; - } - - } while (true); - } - argExprList_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_33); - } else { - throw ex; - } - } - returnAST = argExprList_AST; - } - - protected final void charConst() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode charConst_AST = null; - - try { // for error handling - TNode tmp168_AST = null; - tmp168_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp168_AST); - match(CharLiteral); - charConst_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_60); - } else { - throw ex; - } - } - returnAST = charConst_AST; - } - - protected final void intConst() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode intConst_AST = null; - - try { // for error handling - switch ( LA(1)) { - case IntOctalConst: - { - TNode tmp169_AST = null; - tmp169_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp169_AST); - match(IntOctalConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case LongOctalConst: - { - TNode tmp170_AST = null; - tmp170_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp170_AST); - match(LongOctalConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case UnsignedOctalConst: - { - TNode tmp171_AST = null; - tmp171_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp171_AST); - match(UnsignedOctalConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case IntIntConst: - { - TNode tmp172_AST = null; - tmp172_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp172_AST); - match(IntIntConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case LongIntConst: - { - TNode tmp173_AST = null; - tmp173_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp173_AST); - match(LongIntConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case UnsignedIntConst: - { - TNode tmp174_AST = null; - tmp174_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp174_AST); - match(UnsignedIntConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case IntHexConst: - { - TNode tmp175_AST = null; - tmp175_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp175_AST); - match(IntHexConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case LongHexConst: - { - TNode tmp176_AST = null; - tmp176_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp176_AST); - match(LongHexConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case UnsignedHexConst: - { - TNode tmp177_AST = null; - tmp177_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp177_AST); - match(UnsignedHexConst); - intConst_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_60); - } else { - throw ex; - } - } - returnAST = intConst_AST; - } - - protected final void floatConst() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode floatConst_AST = null; - - try { // for error handling - switch ( LA(1)) { - case FloatDoubleConst: - { - TNode tmp178_AST = null; - tmp178_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp178_AST); - match(FloatDoubleConst); - floatConst_AST = (TNode)currentAST.root; - break; - } - case DoubleDoubleConst: - { - TNode tmp179_AST = null; - tmp179_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp179_AST); - match(DoubleDoubleConst); - floatConst_AST = (TNode)currentAST.root; - break; - } - case LongDoubleConst: - { - TNode tmp180_AST = null; - tmp180_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp180_AST); - match(LongDoubleConst); - floatConst_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_60); - } else { - throw ex; - } - } - returnAST = floatConst_AST; - } - - protected final void stringConst() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode stringConst_AST = null; - - try { // for error handling - { - int _cnt210=0; - _loop210: - do { - if ((LA(1)==StringLiteral)) { - TNode tmp181_AST = null; - tmp181_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp181_AST); - match(StringLiteral); - } - else { - if ( _cnt210>=1 ) { break _loop210; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt210++; - } while (true); - } - if ( inputState.guessing==0 ) { - stringConst_AST = (TNode)currentAST.root; - stringConst_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NStringSeq)).add(stringConst_AST)); - currentAST.root = stringConst_AST; - currentAST.child = stringConst_AST!=null &&stringConst_AST.getFirstChild()!=null ? - stringConst_AST.getFirstChild() : stringConst_AST; - currentAST.advanceChildToEnd(); - } - stringConst_AST = (TNode)currentAST.root; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_60); - } else { - throw ex; - } - } - returnAST = stringConst_AST; - } - - public final void dummy() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode dummy_AST = null; - - try { // for error handling - switch ( LA(1)) { - case NTypedefName: - { - TNode tmp182_AST = null; - tmp182_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp182_AST); - match(NTypedefName); - dummy_AST = (TNode)currentAST.root; - break; - } - case NInitDecl: - { - TNode tmp183_AST = null; - tmp183_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp183_AST); - match(NInitDecl); - dummy_AST = (TNode)currentAST.root; - break; - } - case NDeclarator: - { - TNode tmp184_AST = null; - tmp184_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp184_AST); - match(NDeclarator); - dummy_AST = (TNode)currentAST.root; - break; - } - case NStructDeclarator: - { - TNode tmp185_AST = null; - tmp185_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp185_AST); - match(NStructDeclarator); - dummy_AST = (TNode)currentAST.root; - break; - } - case NDeclaration: - { - TNode tmp186_AST = null; - tmp186_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp186_AST); - match(NDeclaration); - dummy_AST = (TNode)currentAST.root; - break; - } - case NCast: - { - TNode tmp187_AST = null; - tmp187_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp187_AST); - match(NCast); - dummy_AST = (TNode)currentAST.root; - break; - } - case NPointerGroup: - { - TNode tmp188_AST = null; - tmp188_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp188_AST); - match(NPointerGroup); - dummy_AST = (TNode)currentAST.root; - break; - } - case NExpressionGroup: - { - TNode tmp189_AST = null; - tmp189_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp189_AST); - match(NExpressionGroup); - dummy_AST = (TNode)currentAST.root; - break; - } - case NFunctionCallArgs: - { - TNode tmp190_AST = null; - tmp190_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp190_AST); - match(NFunctionCallArgs); - dummy_AST = (TNode)currentAST.root; - break; - } - case NNonemptyAbstractDeclarator: - { - TNode tmp191_AST = null; - tmp191_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp191_AST); - match(NNonemptyAbstractDeclarator); - dummy_AST = (TNode)currentAST.root; - break; - } - case NInitializer: - { - TNode tmp192_AST = null; - tmp192_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp192_AST); - match(NInitializer); - dummy_AST = (TNode)currentAST.root; - break; - } - case NStatementExpr: - { - TNode tmp193_AST = null; - tmp193_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp193_AST); - match(NStatementExpr); - dummy_AST = (TNode)currentAST.root; - break; - } - case NEmptyExpression: - { - TNode tmp194_AST = null; - tmp194_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp194_AST); - match(NEmptyExpression); - dummy_AST = (TNode)currentAST.root; - break; - } - case NParameterTypeList: - { - TNode tmp195_AST = null; - tmp195_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp195_AST); - match(NParameterTypeList); - dummy_AST = (TNode)currentAST.root; - break; - } - case NFunctionDef: - { - TNode tmp196_AST = null; - tmp196_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp196_AST); - match(NFunctionDef); - dummy_AST = (TNode)currentAST.root; - break; - } - case NCompoundStatement: - { - TNode tmp197_AST = null; - tmp197_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp197_AST); - match(NCompoundStatement); - dummy_AST = (TNode)currentAST.root; - break; - } - case NParameterDeclaration: - { - TNode tmp198_AST = null; - tmp198_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp198_AST); - match(NParameterDeclaration); - dummy_AST = (TNode)currentAST.root; - break; - } - case NCommaExpr: - { - TNode tmp199_AST = null; - tmp199_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp199_AST); - match(NCommaExpr); - dummy_AST = (TNode)currentAST.root; - break; - } - case NUnaryExpr: - { - TNode tmp200_AST = null; - tmp200_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp200_AST); - match(NUnaryExpr); - dummy_AST = (TNode)currentAST.root; - break; - } - case NLabel: - { - TNode tmp201_AST = null; - tmp201_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp201_AST); - match(NLabel); - dummy_AST = (TNode)currentAST.root; - break; - } - case NPostfixExpr: - { - TNode tmp202_AST = null; - tmp202_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp202_AST); - match(NPostfixExpr); - dummy_AST = (TNode)currentAST.root; - break; - } - case NRangeExpr: - { - TNode tmp203_AST = null; - tmp203_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp203_AST); - match(NRangeExpr); - dummy_AST = (TNode)currentAST.root; - break; - } - case NStringSeq: - { - TNode tmp204_AST = null; - tmp204_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp204_AST); - match(NStringSeq); - dummy_AST = (TNode)currentAST.root; - break; - } - case NInitializerElementLabel: - { - TNode tmp205_AST = null; - tmp205_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp205_AST); - match(NInitializerElementLabel); - dummy_AST = (TNode)currentAST.root; - break; - } - case NLcurlyInitializer: - { - TNode tmp206_AST = null; - tmp206_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp206_AST); - match(NLcurlyInitializer); - dummy_AST = (TNode)currentAST.root; - break; - } - case NAsmAttribute: - { - TNode tmp207_AST = null; - tmp207_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp207_AST); - match(NAsmAttribute); - dummy_AST = (TNode)currentAST.root; - break; - } - case NGnuAsmExpr: - { - TNode tmp208_AST = null; - tmp208_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp208_AST); - match(NGnuAsmExpr); - dummy_AST = (TNode)currentAST.root; - break; - } - case NTypeMissing: - { - TNode tmp209_AST = null; - tmp209_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp209_AST); - match(NTypeMissing); - dummy_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - consume(); - consumeUntil(_tokenSet_0); - } else { - throw ex; - } - } - returnAST = dummy_AST; - } - - - public static final String[] _tokenNames = { - "<0>", - "EOF", - "<2>", - "NULL_TREE_LOOKAHEAD", - "\"typedef\"", - "\"asm\"", - "\"volatile\"", - "LCURLY", - "RCURLY", - "SEMI", - "\"struct\"", - "\"union\"", - "\"enum\"", - "\"auto\"", - "\"register\"", - "\"extern\"", - "\"static\"", - "\"const\"", - "\"void\"", - "\"char\"", - "\"short\"", - "\"int\"", - "\"long\"", - "\"float\"", - "\"double\"", - "\"signed\"", - "\"unsigned\"", - "ID", - "COMMA", - "COLON", - "ASSIGN", - "STAR", - "LPAREN", - "RPAREN", - "LBRACKET", - "RBRACKET", - "VARARGS", - "\"while\"", - "\"do\"", - "\"for\"", - "\"goto\"", - "\"continue\"", - "\"break\"", - "\"return\"", - "\"case\"", - "\"default\"", - "\"if\"", - "\"else\"", - "\"switch\"", - "DIV_ASSIGN", - "PLUS_ASSIGN", - "MINUS_ASSIGN", - "STAR_ASSIGN", - "MOD_ASSIGN", - "RSHIFT_ASSIGN", - "LSHIFT_ASSIGN", - "BAND_ASSIGN", - "BOR_ASSIGN", - "BXOR_ASSIGN", - "QUESTION", - "LOR", - "LAND", - "BOR", - "BXOR", - "BAND", - "EQUAL", - "NOT_EQUAL", - "LT", - "LTE", - "GT", - "GTE", - "LSHIFT", - "RSHIFT", - "PLUS", - "MINUS", - "DIV", - "MOD", - "INC", - "DEC", - "\"sizeof\"", - "BNOT", - "LNOT", - "PTR", - "DOT", - "CharLiteral", - "StringLiteral", - "IntOctalConst", - "LongOctalConst", - "UnsignedOctalConst", - "IntIntConst", - "LongIntConst", - "UnsignedIntConst", - "IntHexConst", - "LongHexConst", - "UnsignedHexConst", - "FloatDoubleConst", - "DoubleDoubleConst", - "LongDoubleConst", - "NTypedefName", - "NInitDecl", - "NDeclarator", - "NStructDeclarator", - "NDeclaration", - "NCast", - "NPointerGroup", - "NExpressionGroup", - "NFunctionCallArgs", - "NNonemptyAbstractDeclarator", - "NInitializer", - "NStatementExpr", - "NEmptyExpression", - "NParameterTypeList", - "NFunctionDef", - "NCompoundStatement", - "NParameterDeclaration", - "NCommaExpr", - "NUnaryExpr", - "NLabel", - "NPostfixExpr", - "NRangeExpr", - "NStringSeq", - "NInitializerElementLabel", - "NLcurlyInitializer", - "NAsmAttribute", - "NGnuAsmExpr", - "NTypeMissing", - "Vocabulary", - "Whitespace", - "Comment", - "CPPComment", - "a line directive", - "Space", - "LineDirective", - "BadStringLiteral", - "Escape", - "Digit", - "LongSuffix", - "UnsignedSuffix", - "FloatSuffix", - "Exponent", - "Number" - }; - - protected void buildTokenTypeASTClassMap() { - tokenTypeToASTClassMap=null; - }; - - private static final long[] mk_tokenSet_0() { - long[] data = { 2L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); - private static final long[] mk_tokenSet_1() { - long[] data = { 6710885488L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); - private static final long[] mk_tokenSet_2() { - long[] data = { 268434512L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); - private static final long[] mk_tokenSet_3() { - long[] data = { 6710886096L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3()); - private static final long[] mk_tokenSet_4() { - long[] data = { 6710860864L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4()); - private static final long[] mk_tokenSet_5() { - long[] data = { 92610232016L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5()); - private static final long[] mk_tokenSet_6() { - long[] data = { 6710885490L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6()); - private static final long[] mk_tokenSet_7() { - long[] data = { 422150456475634L, 17179076097L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7()); - private static final long[] mk_tokenSet_8() { - long[] data = { 268409920L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8()); - private static final long[] mk_tokenSet_9() { - long[] data = { 6710860992L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9()); - private static final long[] mk_tokenSet_10() { - long[] data = { 6576668672L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_10 = new BitSet(mk_tokenSet_10()); - private static final long[] mk_tokenSet_11() { - long[] data = { 6576668672L, 17179076097L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_11 = new BitSet(mk_tokenSet_11()); - private static final long[] mk_tokenSet_12() { - long[] data = { 43754980096L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_12 = new BitSet(mk_tokenSet_12()); - private static final long[] mk_tokenSet_13() { - long[] data = { 268180480L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_13 = new BitSet(mk_tokenSet_13()); - private static final long[] mk_tokenSet_14() { - long[] data = { 32749125328L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_14 = new BitSet(mk_tokenSet_14()); - private static final long[] mk_tokenSet_15() { - long[] data = { 32614908416L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_15 = new BitSet(mk_tokenSet_15()); - private static final long[] mk_tokenSet_16() { - long[] data = { 512L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_16 = new BitSet(mk_tokenSet_16()); - private static final long[] mk_tokenSet_17() { - long[] data = { 32749125200L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_17 = new BitSet(mk_tokenSet_17()); - private static final long[] mk_tokenSet_18() { - long[] data = { 33285996112L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_18 = new BitSet(mk_tokenSet_18()); - private static final long[] mk_tokenSet_19() { - long[] data = { 134217856L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_19 = new BitSet(mk_tokenSet_19()); - private static final long[] mk_tokenSet_20() { - long[] data = { 268311616L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_20 = new BitSet(mk_tokenSet_20()); - private static final long[] mk_tokenSet_21() { - long[] data = { 256L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_21 = new BitSet(mk_tokenSet_21()); - private static final long[] mk_tokenSet_22() { - long[] data = { 268311872L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_22 = new BitSet(mk_tokenSet_22()); - private static final long[] mk_tokenSet_23() { - long[] data = { 33017437376L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_23 = new BitSet(mk_tokenSet_23()); - private static final long[] mk_tokenSet_24() { - long[] data = { 32883343360L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_24 = new BitSet(mk_tokenSet_24()); - private static final long[] mk_tokenSet_25() { - long[] data = { 268435968L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_25 = new BitSet(mk_tokenSet_25()); - private static final long[] mk_tokenSet_26() { - long[] data = { 35165045504L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_26 = new BitSet(mk_tokenSet_26()); - private static final long[] mk_tokenSet_27() { - long[] data = { 32749124816L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_27 = new BitSet(mk_tokenSet_27()); - private static final long[] mk_tokenSet_28() { - long[] data = { 100931731152L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_28 = new BitSet(mk_tokenSet_28()); - private static final long[] mk_tokenSet_29() { - long[] data = { 79456894672L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_29 = new BitSet(mk_tokenSet_29()); - private static final long[] mk_tokenSet_30() { - long[] data = { 268435712L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_30 = new BitSet(mk_tokenSet_30()); - private static final long[] mk_tokenSet_31() { - long[] data = { 268436224L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_31 = new BitSet(mk_tokenSet_31()); - private static final long[] mk_tokenSet_32() { - long[] data = { 30467424256L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_32 = new BitSet(mk_tokenSet_32()); - private static final long[] mk_tokenSet_33() { - long[] data = { 8589934592L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_33 = new BitSet(mk_tokenSet_33()); - private static final long[] mk_tokenSet_34() { - long[] data = { 6576668800L, 17179076097L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_34 = new BitSet(mk_tokenSet_34()); - private static final long[] mk_tokenSet_35() { - long[] data = { 32615039040L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_35 = new BitSet(mk_tokenSet_35()); - private static final long[] mk_tokenSet_36() { - long[] data = { 23622320128L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_36 = new BitSet(mk_tokenSet_36()); - private static final long[] mk_tokenSet_37() { - long[] data = { 67108863056L, 17179076097L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_37 = new BitSet(mk_tokenSet_37()); - private static final long[] mk_tokenSet_38() { - long[] data = { 8858370048L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_38 = new BitSet(mk_tokenSet_38()); - private static final long[] mk_tokenSet_39() { - long[] data = { 422081602782080L, 17179076097L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_39 = new BitSet(mk_tokenSet_39()); - private static final long[] mk_tokenSet_40() { - long[] data = { -111669149710L, 17179869183L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_40 = new BitSet(mk_tokenSet_40()); - private static final long[] mk_tokenSet_41() { - long[] data = { 562819225354226L, 17179076097L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_41 = new BitSet(mk_tokenSet_41()); - private static final long[] mk_tokenSet_42() { - long[] data = { 422081602781824L, 17179076097L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_42 = new BitSet(mk_tokenSet_42()); - private static final long[] mk_tokenSet_43() { - long[] data = { 562819091137408L, 17179076097L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_43 = new BitSet(mk_tokenSet_43()); - private static final long[] mk_tokenSet_44() { - long[] data = { -562924720611776L, 17179869183L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_44 = new BitSet(mk_tokenSet_44()); - private static final long[] mk_tokenSet_45() { - long[] data = { -111669149744L, 17179869183L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_45 = new BitSet(mk_tokenSet_45()); - private static final long[] mk_tokenSet_46() { - long[] data = { 575897847178724096L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_46 = new BitSet(mk_tokenSet_46()); - private static final long[] mk_tokenSet_47() { - long[] data = { 1152358599482147584L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_47 = new BitSet(mk_tokenSet_47()); - private static final long[] mk_tokenSet_48() { - long[] data = { 2305280104088994560L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_48 = new BitSet(mk_tokenSet_48()); - private static final long[] mk_tokenSet_49() { - long[] data = { 4611123113302688512L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_49 = new BitSet(mk_tokenSet_49()); - private static final long[] mk_tokenSet_50() { - long[] data = { 9222809131730076416L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_50 = new BitSet(mk_tokenSet_50()); - private static final long[] mk_tokenSet_51() { - long[] data = { -562905124699392L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_51 = new BitSet(mk_tokenSet_51()); - private static final long[] mk_tokenSet_52() { - long[] data = { -562905124699392L, 1L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_52 = new BitSet(mk_tokenSet_52()); - private static final long[] mk_tokenSet_53() { - long[] data = { -562905124699392L, 7L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_53 = new BitSet(mk_tokenSet_53()); - private static final long[] mk_tokenSet_54() { - long[] data = { -562905124699392L, 127L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_54 = new BitSet(mk_tokenSet_54()); - private static final long[] mk_tokenSet_55() { - long[] data = { -562905124699392L, 511L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_55 = new BitSet(mk_tokenSet_55()); - private static final long[] mk_tokenSet_56() { - long[] data = { 2147483648L, 6144L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_56 = new BitSet(mk_tokenSet_56()); - private static final long[] mk_tokenSet_57() { - long[] data = { -562905124699392L, 2047L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_57 = new BitSet(mk_tokenSet_57()); - private static final long[] mk_tokenSet_58() { - long[] data = { -562881368161536L, 17179869183L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_58 = new BitSet(mk_tokenSet_58()); - private static final long[] mk_tokenSet_59() { - long[] data = { -562902977215744L, 8191L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_59 = new BitSet(mk_tokenSet_59()); - private static final long[] mk_tokenSet_60() { - long[] data = { -562881502379264L, 819199L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_60 = new BitSet(mk_tokenSet_60()); - - } diff --git a/app/preproc/TNode.java b/app/preproc/TNode.java deleted file mode 100755 index 378c63a3a..000000000 --- a/app/preproc/TNode.java +++ /dev/null @@ -1,434 +0,0 @@ -package processing.app.preproc; - -import antlr.collections.AST; -import antlr.CommonAST; -import antlr.Token; -import java.lang.reflect.*; -import java.util.Hashtable; -import java.util.Enumeration; -//import CToken; - -/** - Class TNode is an implementation of the AST interface - and adds many useful features: - - It is double-linked for reverse searching. - (this is currently incomplete, in that method doubleLink() must - be called after any changes to the tree to maintain the - reverse links). - - It can store a definition node (defNode), so that nodes such - as scoped names can refer to the node that defines the name. - - It stores line numbers for nodes. - - Searches for parents and children of a tree can be done - based on their type. - - The tree can be printed to System.out using a lisp-style syntax. - - - - */ -public class TNode extends CommonAST { - protected int ttype; - protected String text; - protected int lineNum = 0; - protected TNode defNode; - protected TNode up; - protected TNode left; - protected boolean marker = false; - protected Hashtable attributes = null; - static String tokenVocabulary; - - - - - /** Set the token vocabulary to a tokentypes class - generated by antlr. - */ - public static void setTokenVocabulary(String s) { - tokenVocabulary = s; - } - - -public void initialize(Token token) { - CToken tok = (CToken) token; - setText(tok.getText()); - setType(tok.getType()); - setLineNum(tok.getLine()); - setAttribute("source", tok.getSource()); - setAttribute("tokenNumber", new Integer(tok.getTokenNumber())); -} -public void initialize(AST tr) { - TNode t = (TNode) tr; - setText(t.getText()); - setType(t.getType()); - setLineNum(t.getLineNum()); - setDefNode(t.getDefNode()); - this.attributes = t.getAttributesTable(); -} - - - /** Get the token type for this node */ - public int getType() { return ttype; } - - /** Set the token type for this node */ - public void setType(int ttype_) { - ttype = ttype_; - } - - /** Get the marker value for this node. - This member is a general-use marker. - */ - public boolean getMarker() { return marker; } - - /** Set the marker value for this node. - This property is a general-use boolean marker. - */ - public void setMarker(boolean marker_) { - marker = marker_; - } - - /** get the hashtable that holds attribute values. - */ - public Hashtable getAttributesTable() { - if(attributes == null) - attributes = new Hashtable(7); - return attributes; - } - - /** set an attribute in the attribute table. - */ - public void setAttribute(String attrName, Object value) { - if(attributes == null) - attributes = new Hashtable(7); - attributes.put(attrName,value); - } - - /** lookup the attribute name in the attribute table. - If the value does not exist, it returns null. - */ - public Object getAttribute(String attrName) { - if(attributes == null) - return null; - else - return attributes.get(attrName); - } - - /** Get the line number for this node. - If the line number is 0, search for a non-zero line num among children */ - public int getLineNum() { - if(lineNum != 0) - return lineNum; - else - if(down == null) - return lineNum; - else - return ((TNode)down).getLocalLineNum(); - } - - public int getLocalLineNum() { - if(lineNum != 0) - return lineNum; - else - if(down == null) - if(right == null) - return lineNum; - else - return ((TNode)right).getLocalLineNum(); - else - return ((TNode)down).getLocalLineNum(); - } - - /** Set the line number for this node */ - public void setLineNum(int lineNum_) { - lineNum = lineNum_; - } - - /** Get the token text for this node */ - public String getText() { return text; } - - /** Set the token text for this node */ - public void setText(String text_) { - text = text_; - } - - /** return the last child of this node, or null if there is none */ - public TNode getLastChild() { - TNode down = (TNode)getFirstChild(); - if(down != null) - return down.getLastSibling(); - else - return null; - } - - /** return the last sibling of this node, which is - this if the next sibling is null */ - public TNode getLastSibling() { - TNode next = (TNode)getNextSibling(); - if(next != null) - return next.getLastSibling(); - else - return this; - } - - /** return the first sibling of this node, which is - this if the prev sibling is null */ - public TNode getFirstSibling() { - TNode prev = (TNode)left; - if(prev != null) - return prev.getFirstSibling(); - else - return this; - } - - - /** return the parent node of this node */ - public TNode getParent() { - return (TNode)getFirstSibling().up; - } - - - /** add the new node as a new sibling, inserting it ahead of any - existing next sibling. This method maintains double-linking. - if node is null, nothing happens. If the node has siblings, - then they are added in as well. - */ - public void addSibling(AST node) { - if(node == null) return; - TNode next = (TNode)right; - right = (TNode)node; - ((TNode)node).left = this; - TNode nodeLastSib = ((TNode)node).getLastSibling(); - nodeLastSib.right = next; - if(next != null) - next.left = nodeLastSib; - } - - - /** return the number of children of this node */ - public int numberOfChildren() { - int count = 0; - AST child = getFirstChild(); - while(child != null) { - count++; - child = child.getNextSibling(); - } - return count; - } - - - /** remove this node from the tree, resetting sibling and parent - pointers as necessary. This method maintains double-linking */ - public void removeSelf() { - TNode parent = (TNode)up; - TNode prev = (TNode)left; - TNode next = (TNode)right; - - if(parent != null) { - parent.down = next; - if(next != null) { - next.up = parent; - next.left = prev; // which should be null - } - } - else { - if(prev != null) - prev.right = next; - if(next != null) - next.left = prev; - } - } - - - /** return the def node for this node */ - public TNode getDefNode() { - return defNode; - } - - /** set the def node for this node */ - public void setDefNode(TNode n) { - defNode = n; - } - - - /** return a deep copy of this node, and all sub nodes. - New tree is doubleLinked, with no parent or siblings. - Marker value is not copied! - */ - public TNode deepCopy() { - TNode copy = new TNode(); - copy.ttype = ttype; - copy.text = text; - copy.lineNum = lineNum; - copy.defNode = defNode; - if(attributes != null) - copy.attributes = (Hashtable)attributes.clone(); - if(down != null) - copy.down = ((TNode)down).deepCopyWithRightSiblings(); - copy.doubleLink(); - return copy; - } - - - /** return a deep copy of this node, all sub nodes, - and right siblings. - New tree is doubleLinked, with no parent or left siblings. - defNode is not copied */ - public TNode deepCopyWithRightSiblings() { - TNode copy = new TNode(); - copy.ttype = ttype; - copy.text = text; - copy.lineNum = lineNum; - copy.defNode = defNode; - if(attributes != null) - copy.attributes = (Hashtable)attributes.clone(); - if(down != null) - copy.down = ((TNode)down).deepCopyWithRightSiblings(); - if(right != null) - copy.right = ((TNode)right).deepCopyWithRightSiblings(); - copy.doubleLink(); - return copy; - } - - - /** return a short string representation of the node */ - public String toString() { - StringBuffer str = new StringBuffer( getNameForType(getType()) + - "[" + getText() + ", " + "]"); - - if(this.getLineNum() != 0) - str.append(" line:" + (this.getLineNum() ) ); - - Enumeration keys = (this.getAttributesTable().keys()); - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - str.append(" " + key + ":" + (this.getAttribute(key))); - } - - return str.toString(); - } - - - /** print given tree to System.out */ - public static void printTree(AST t) { - if (t == null) return; - printASTNode(t,0); - System.out.print("\n"); - } - - - /** protected method that does the work of printing */ - protected static void printASTNode(AST t, int indent) { - AST child1, next; - child1 = t.getFirstChild(); - - System.out.print("\n"); - for(int i = 0; i < indent; i++) - System.out.print(" "); - - if(child1 != null) - System.out.print("("); - - String s = t.getText(); - if(s != null && s.length() > 0) { - System.out.print(getNameForType(t.getType())); - System.out.print(": \"" + s + "\""); - } - else - System.out.print(getNameForType(t.getType())); - if(((TNode)t).getLineNum() != 0) - System.out.print(" line:" + ((TNode)t).getLineNum() ); - - Enumeration keys = ((TNode)t).getAttributesTable().keys(); - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - System.out.print(" " + key + ":" + ((TNode)t).getAttribute(key)); - } - TNode def = ((TNode)t).getDefNode(); - if(def != null) - System.out.print("[" + getNameForType(def.getType()) + "]"); - - - if(child1 != null) { - printASTNode(child1,indent + 1); - - System.out.print("\n"); - for(int i = 0; i < indent; i++) - System.out.print(" "); - System.out.print(")"); - } - - next = t.getNextSibling(); - if(next != null) { - printASTNode(next,indent); - } - } - - /** converts an int tree token type to a name. - Does this by reflecting on nsdidl.IDLTreeTokenTypes, - and is dependent on how ANTLR 2.00 outputs that class. */ - public static String getNameForType(int t) { - try{ - Class c = Class.forName(tokenVocabulary); - Field[] fields = c.getDeclaredFields(); - if(t-2 < fields.length) - return fields[t-2].getName(); - } catch (Exception e) { System.out.println(e); } - return "unfoundtype: " + t; - } - - - /** set up reverse links between this node and its first - child and its first sibling, and link those as well */ - public void doubleLink() { - TNode right = (TNode)getNextSibling(); - if(right != null) { - right.left = this; - right.doubleLink(); - } - TNode down = (TNode)getFirstChild(); - if(down != null) { - down.up = this; - down.doubleLink(); - } - } - - /** find first parent of the given type, - return null on failure */ - public TNode parentOfType(int type) { - if(up == null) { - if(left == null) - return null; - else - return left.parentOfType(type); - } - if(up.getType() == type) - return up; - return up.parentOfType(type); - } - - /** find the first child of the node - of the given type, return null on failure */ - public TNode firstChildOfType(int type) { - TNode down = (TNode)getFirstChild(); - if(down == null) - return null; - if(down.getType() == type) - return down; - return down.firstSiblingOfType(type); - } - - /** find the first sibling of the node - of the given type, return null on failure */ - public TNode firstSiblingOfType(int type) { - TNode right = (TNode)getNextSibling(); - if(right == null) - return null; - if(right.getType() == type) - return right; - return right.firstSiblingOfType(type); - } - -} diff --git a/app/preproc/TNodeFactory.java b/app/preproc/TNodeFactory.java deleted file mode 100755 index 589880a19..000000000 --- a/app/preproc/TNodeFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -package processing.app.preproc; - -import antlr.Token; -import antlr.ASTFactory; -import antlr.collections.AST; - -/** This class extends ASTFactory to build instances - of class TNode */ -public class TNodeFactory extends ASTFactory { - - /** Create a new ampty AST node */ - public AST create() { - return new TNode(); - } - - /** Create a new AST node from type and text */ - public AST create(int ttype, String text) { - AST ast = new TNode(); - ast.setType(ttype); - ast.setText(text); - return ast; - } - - /** Create a new AST node from an existing AST node */ - public AST create(AST ast) { - AST newast = new TNode(); - newast.setType(ast.getType()); - newast.setText(ast.getText()); - return newast; - } - - -} diff --git a/app/preproc/WEmitter.g b/app/preproc/WEmitter.g deleted file mode 100755 index afbd0d3cf..000000000 --- a/app/preproc/WEmitter.g +++ /dev/null @@ -1,1191 +0,0 @@ -/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - Copyright (c) Non, Inc. 1998 -- All Rights Reserved - -PROJECT: C Compiler -MODULE: WEmitter -FILE: WEmitter.g - -AUTHOR: Monty Zukowski (jamz@cdsnet.net) April 28, 1998 -MODIFICATIONS: Hernando Barragan added support for the Wiring language - -DESCRIPTION: - - This tree grammar is for a Gnu C AST. - It turns the tree back into source code. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ - - -header { -package processing.app.preproc; -import processing.app.*; -import java.io.*; -import java.util.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; -} - - -class WEmitter extends WTreeParser; - -options - { - importVocab = W; - buildAST = false; - ASTLabelType = "TNode"; - - // Copied following options from java grammar. - codeGenMakeSwitchThreshold = 2; - codeGenBitsetTestThreshold = 3; - } - - -{ - - -int tabs = 0; -PrintStream currentOutput = System.out; -int lineNum = 1; -String currentSource = ""; -LineObject trueSourceFile; -final int lineDirectiveThreshold = Integer.MAX_VALUE; -PreprocessorInfoChannel preprocessorInfoChannel = null; -Stack sourceFiles = new Stack(); - -WEmitter( PreprocessorInfoChannel preprocChannel ) -{ - preprocessorInfoChannel = preprocChannel; -} - - -public void setOut(PrintStream out) { - this.currentOutput = out; -} - -boolean childContains(AST ast, String childName) { - AST child = ast.getFirstChild(); - AST childchild; - while (child != null) { - //System.out.println(child.getText()); - if (child.getText().equals(childName)) { - // debug.println("getChild: found:" + name(ast)); - return true; - } - if(child.getFirstChild() != null) { - if(childContains(child, childName)) { - return true; - } - } - child = child.getNextSibling(); - } - return false; -} - -public void printDeclarations(AST ast) throws RunnerException { - if (ast == null) { - return; - } - - /*if(!childContains(ast, "serialEvent")) { - currentOutput.print("void serialEvent() {}"); - }*/ - if(!childContains(ast, "setup")) { - currentOutput.print("void setup() {}"); - } - if(!childContains(ast, "loop")) { - currentOutput.print("void loop() {}"); - } -} - - -void initializePrinting() -{ - Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber( new Integer(1) ); - printPreprocs(preprocs); -/* if ( currentSource.equals("") ) { - trueSourceFile = new LineObject(currentSource); - currentOutput.println("# 1 \"" + currentSource + "\"\n"); - sourceFiles.push(trueSourceFile); - } -*/ -} - -void finalizePrinting() { - // flush any leftover preprocessing instructions to the stream - - printPreprocs( - preprocessorInfoChannel.extractLinesPrecedingTokenNumber( - new Integer( preprocessorInfoChannel.getMaxTokenNumber() + 1 ) )); - //print a newline so file ends at a new line - currentOutput.println(); -} - -void printPreprocs( Vector preprocs ) -{ - // if there was a preprocessingDirective previous to this token then - // print a newline and the directive, line numbers handled later - if ( preprocs.size() > 0 ) { - if ( trueSourceFile != null ) { - currentOutput.println(); //make sure we're starting a new line unless this is the first line directive - } - lineNum++; - Enumeration e = preprocs.elements(); - while (e.hasMoreElements()) - { - Object o = e.nextElement(); - if ( o.getClass().getName().equals("LineObject") ) { - LineObject l = (LineObject) o; - - // we always return to the trueSourceFile, we never enter it from another file - // force it to be returning if in fact we aren't currently in trueSourceFile - if (( trueSourceFile != null ) //trueSource exists - && ( !currentSource.equals(trueSourceFile.getSource()) ) //currently not in trueSource - && ( trueSourceFile.getSource().equals(l.getSource()) ) ) { //returning to trueSource - l.setEnteringFile( false ); - l.setReturningToFile( true ); - } - - - // print the line directive - currentOutput.println(l); - lineNum = l.getLine(); - currentSource = l.getSource(); - - - // the very first line directive always represents the true sourcefile - if ( trueSourceFile == null ) { - trueSourceFile = new LineObject(currentSource); - sourceFiles.push(trueSourceFile); - } - - // keep our own stack of files entered - if ( l.getEnteringFile() ) { - sourceFiles.push(l); - } - - // if returning to a file, pop the exited files off the stack - if ( l.getReturningToFile() ) { - LineObject top = (LineObject) sourceFiles.peek(); - while (( top != trueSourceFile ) && (! l.getSource().equals(top.getSource()) )) { - sourceFiles.pop(); - top = (LineObject) sourceFiles.peek(); - } - } - } - else { // it was a #pragma or such - currentOutput.println(o); - lineNum++; - } - } - } - -} - -void print( TNode t ) { - int tLineNum = t.getLocalLineNum(); - if ( tLineNum == 0 ) tLineNum = lineNum; - - Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber((Integer)t.getAttribute("tokenNumber")); - printPreprocs(preprocs); - - if ( (lineNum != tLineNum) ) { - // we know we'll be newlines or a line directive or it probably - // is just the case that this token is on the next line - // either way start a new line and indent it - currentOutput.println(); - lineNum++; - printTabs(); - } - - if ( lineNum == tLineNum ){ - // do nothing special, we're at the right place - } - else { - int diff = tLineNum - lineNum; - if ( lineNum < tLineNum ) { - // print out the blank lines to bring us up to right line number - for ( ; lineNum < tLineNum ; lineNum++ ) { - currentOutput.println(); - } - printTabs(); - } - else { // just reset lineNum - lineNum = tLineNum; - } - } - currentOutput.print( t.getText() + " " ); -} - - -/* This was my attempt at being smart about line numbers - It didn't work quite right but I don't know why, I didn't - have enough test cases. Worked ok compiling rcs and ghostscript -*/ -void printAddingLineDirectives( TNode t ) { - int tLineNum = t.getLocalLineNum(); - String tSource = (String) t.getAttribute("source"); - - if ( tSource == null ) tSource = currentSource; - if ( tLineNum == 0 ) tLineNum = lineNum; - - Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber((Integer)t.getAttribute("tokenNumber")); - printPreprocs(preprocs); - - if ( (lineNum != tLineNum) || !currentSource.equals(tSource) ) { - // we know we'll be newlines or a line directive or it probably - // is just the case that this token is on the next line - // either way start a new line and indent it - currentOutput.println(); - lineNum++; - printTabs(); - } - - if ( ( lineNum == tLineNum ) && ( currentSource.equals(tSource) ) ){ - // do nothing special, we're at the right place - } - else if ( currentSource.equals(tSource) ) { - int diff = tLineNum - lineNum; - if (diff > 0 && diff < lineDirectiveThreshold) { - // print out the blank lines to bring us up to right line number - for ( ; lineNum < tLineNum ; lineNum++ ) { - currentOutput.println(); - } - } - else { // print line directive to get us to right line number - // preserve flags 3 and 4 if present in current file - if ( ! sourceFiles.empty() ) { - LineObject l = (LineObject) sourceFiles.peek(); - StringBuffer tFlags = new StringBuffer(""); - if (l.getSystemHeader()) { - tFlags.append(" 3"); - } - if (l.getTreatAsC()) { - tFlags.append(" 4"); - } - currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + tFlags.toString()); - lineNum = tLineNum; - } - } - - printTabs(); - } - else { // different source - Enumeration sources = sourceFiles.elements(); - // see if we're returning to a file we entered earlier - boolean returningToEarlierFile = false; - while (sources.hasMoreElements()) { - LineObject l = (LineObject) sources.nextElement(); - if (l.getSource().equals(tSource)) { - returningToEarlierFile = true; - break; - } - } - if (returningToEarlierFile) { - // pop off the files we're exiting, but never pop the trueSourceFile - LineObject l = (LineObject) sourceFiles.peek(); - while ( ( l != trueSourceFile ) &&(! l.getSource().equals(tSource) ) ) { - sourceFiles.pop(); - l = (LineObject) sourceFiles.peek(); - } - - // put in the return flag, plus others as needed - StringBuffer tFlags = new StringBuffer(" 2"); - if (l.getSystemHeader()) { - tFlags.append(" 3"); - } - if (l.getTreatAsC()) { - tFlags.append(" 4"); - } - - currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + tFlags); - lineNum = tLineNum; - currentSource = tSource; - printTabs(); - } - else { // entering a file that wasn't in the original source - // pretend we're entering it from top of stack - currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + " 1"); - lineNum = tLineNum; - currentSource = tSource; - printTabs(); - } - } - currentOutput.print( t.getText() + " " ); -} - -/** It is not ok to print newlines from the String passed in as -it will screw up the line number handling **/ -void print( String s ) { - currentOutput.print( s + " " ); -} - -void printTabs() { - for ( int i = 0; i< tabs; i++ ) { - currentOutput.print( "\t" ); - } -} - -void commaSep( TNode t ) { - print( t ); - if ( t.getNextSibling() != null ) { - print( "," ); - } -} - - int traceDepth = 0; - public void reportError(RecognitionException ex) { - if ( ex != null) { - System.err.println("ANTLR Tree Parsing RecognitionException Error: " + ex.getClass().getName() + " " + ex ); - ex.printStackTrace(System.err); - } - } - public void reportError(NoViableAltException ex) { - System.err.println("ANTLR Tree Parsing NoViableAltException Error: " + ex.toString()); - TNode.printTree( ex.node ); - ex.printStackTrace(System.err); - } - public void reportError(MismatchedTokenException ex) { - if ( ex != null) { - TNode.printTree( ex.node ); - System.err.println("ANTLR Tree Parsing MismatchedTokenException Error: " + ex ); - ex.printStackTrace(System.err); - } - } - public void reportError(String s) { - System.err.println("ANTLR Error from String: " + s); - } - public void reportWarning(String s) { - System.err.println("ANTLR Warning from String: " + s); - } - protected void match(AST t, int ttype) throws MismatchedTokenException { - //System.out.println("match("+ttype+"); cursor is "+t); - super.match(t, ttype); - } - public void match(AST t, BitSet b) throws MismatchedTokenException { - //System.out.println("match("+b+"); cursor is "+t); - super.match(t, b); - } - protected void matchNot(AST t, int ttype) throws MismatchedTokenException { - //System.out.println("matchNot("+ttype+"); cursor is "+t); - super.matchNot(t, ttype); - } - public void traceIn(String rname, AST t) { - traceDepth += 1; - for (int x=0; x typeName - | expr - ) - rp:RPAREN { print( rp ); } - ) - | p:"__complex" { print( p ); } - ; - - -typedefName - : #(NTypedefName i:ID { print( i ); } ) - ; - - -structSpecifier - : #( a:"struct" { print( a ); } - structOrUnionBody - ) - ; - -unionSpecifier - : #( a:"union" { print( a ); } - structOrUnionBody - ) - ; - -structOrUnionBody - : ( (ID LCURLY) => i1:ID lc1:LCURLY { print( i1 ); print ( "{" ); tabs++; } - ( structDeclarationList )? - rc1:RCURLY { tabs--; print( rc1 ); } - | lc2:LCURLY { print( lc2 ); tabs++; } - ( structDeclarationList )? - rc2:RCURLY { tabs--; print( rc2 ); } - | i2:ID { print( i2 ); } - ) - ; - -structDeclarationList - : ( structDeclaration { print( ";" ); } - )+ - ; - - -structDeclaration - : specifierQualifierList structDeclaratorList - ; - - -specifierQualifierList - : ( - typeSpecifier - | typeQualifier - )+ - ; - - -structDeclaratorList - : structDeclarator - ( { print(","); } structDeclarator )* - ; - - -structDeclarator - : - #( NStructDeclarator - ( declarator )? - ( c:COLON { print( c ); } expr )? - ( attributeDecl )* - ) - ; - - -enumSpecifier - : #( a:"enum" { print( a ); } - ( i:ID { print( i ); } )? - ( lc:LCURLY { print( lc ); tabs++; } - enumList - rc:RCURLY { tabs--; print( rc ); } - )? - ) - ; - - -enumList - : - enumerator ( {print(",");} enumerator)* - ; - - -enumerator - : i:ID { print( i ); } - ( b:ASSIGN { print( b ); } - expr - )? - ; - - -attributeDecl: - #( a:"__attribute" { print( a ); } - (b:. { print( b ); } )* - ) - | #( n:NAsmAttribute { print( n ); } - lp:LPAREN { print( lp ); } - expr { print( ")" ); } - rp:RPAREN { print( rp ); } - ) - ; - -initDeclList - : initDecl - ( { print( "," ); } initDecl )* - ; - - -initDecl - { String declName = ""; } - : #(NInitDecl - declarator - ( attributeDecl )* - ( a:ASSIGN { print( a ); } - initializer - | b:COLON { print( b ); } - expr - )? - ) - ; - - -pointerGroup - : #( NPointerGroup - ( a:STAR { print( a ); } - ( typeQualifier )* - )+ - ) - ; - - - -idList - : i:ID { print( i ); } - ( c:COMMA { print( c ); } - id:ID { print( id ); } - )* - ; - - - -initializer - : #( NInitializer (initializerElementLabel)? expr ) - | lcurlyInitializer - ; - -initializerElementLabel - : #( NInitializerElementLabel - ( - ( l:LBRACKET { print( l ); } - expr - r:RBRACKET { print( r ); } - (a1:ASSIGN { print( a1 ); } )? - ) - | i1:ID c:COLON { print( i1 ); print( c ); } - | d:DOT i2:ID a2:ASSIGN { print( d ); print( i2 ); print( a2 ); } - ) - ) - ; - -lcurlyInitializer - : #(n:NLcurlyInitializer { print( n ); tabs++; } - initializerList - rc:RCURLY { tabs--; print( rc ); } - ) - ; - -initializerList - : ( i:initializer { commaSep( i ); } - )* - ; - - -declarator - : #( NDeclarator - ( pointerGroup )? - - ( id:ID { print( id ); } - | lp:LPAREN { print( lp ); } declarator rp:RPAREN { print( rp ); } - ) - - ( #( n:NParameterTypeList { print( n ); } - ( - parameterTypeList - | (idList)? - ) - r:RPAREN { print( r ); } - ) - | lb:LBRACKET { print( lb );} ( expr )? rb:RBRACKET { print( rb ); } - )* - ) - ; - - - -parameterTypeList - : ( parameterDeclaration - ( c:COMMA { print( c ); } - | s:SEMI { print( s ); } - )? - )+ - ( v:VARARGS { print( v ); } )? - ; - - - -parameterDeclaration - : #( NParameterDeclaration - declSpecifiers - (declarator | nonemptyAbstractDeclarator)? - ) - ; - - -functionDef - : #( NFunctionDef - ( functionDeclSpecifiers)? - declarator - (declaration - | v:VARARGS { print( v ); } - )* - compoundStatement - ) - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - -functionDeclSpecifiers - : - ( functionStorageClassSpecifier - | typeQualifier - | typeSpecifier - )+ - ; - -declarationList - : - ( //ANTLR doesn't know that declarationList properly eats all the declarations - //so it warns about the ambiguity - options { - warnWhenFollowAmbig = false; - } : - localLabelDecl - | declaration - )+ - ; - -localLabelDecl - : #(a:"__label__" { print( a ); } - ( i:ID { commaSep( i ); } - )+ - { print( ";" ); } - ) - ; - - - -compoundStatement - : #( cs:NCompoundStatement { print( cs ); tabs++; } - ( declarationList - | functionDef - )* - ( statementList )? - rc:RCURLY { tabs--; print( rc ); } - ) - - ; - -statementList - : ( statement )+ - ; - -statement - : statementBody - ; - -statementBody - : s:SEMI { print( s ); } - - | compoundStatement // Group of statements - - | #(NStatementExpr - expr { print( ";" ); } - ) // Expressions - -// Iteration statements: - - | #( w:"while" { print( w ); print( "(" ); } - expr { print( ")" ); } - statement ) - - | #( d:"do" { print( d ); } - statement - { print( " while ( " ); } - expr - { print( " );" ); } - ) - - | #( f:"for" { print( f ); print( "(" ); } - expr { print( ";" ); } - expr { print( ";" ); } - expr { print( ")" ); } - statement - ) - - -// Jump statements: - - | #( g:"goto" { print( g );} - expr { print( ";" ); } - ) - | c:"continue" { print( c ); print( ";" );} - | b:"break" { print( b ); print( ";" );} - | #( r:"return" { print( r ); } - ( expr )? - { print( ";" ); } - ) - - -// Labeled statements: - | #( NLabel - ni:ID { print( ni ); print( ":" ); } - ( statement )? - ) - - | #( - ca:"case" { print( ca ); } - expr { print( ":" ); } - (statement)? - ) - - | #( - de:"default" { print( de ); print( ":" ); } - (statement)? - ) - - - -// Selection statements: - - | #( i:"if" { print( i ); print( "(" ); } - expr { print( ")" ); } - statement - ( e:"else" { print( e ); } - statement - )? - ) - | #( sw:"switch" { print( sw ); print( "(" ); } - expr { print( ")" ); } - statement - ) - - - - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - - - - - -expr - : - binaryExpr - | conditionalExpr - | castExpr - | unaryExpr - | postfixExpr - | primaryExpr - | emptyExpr - | compoundStatementExpr - | initializer - | rangeExpr - | gnuAsmExpr - ; - -emptyExpr - : NEmptyExpression - ; - -compoundStatementExpr - : #(l:LPAREN { print( l ); } - compoundStatement - r:RPAREN { print( r ); } - ) - ; - -rangeExpr - : #(NRangeExpr expr v:VARARGS{ print( v ); } expr) - ; - -gnuAsmExpr - : #(n:NGnuAsmExpr { print( n ); } - (v:"volatile" { print( v ); } )? - lp:LPAREN { print( lp ); } - stringConst - ( options { warnWhenFollowAmbig = false; }: - c1:COLON { print( c1 );} - (strOptExprPair - ( c2:COMMA { print( c2 ); } strOptExprPair)* - )? - ( options { warnWhenFollowAmbig = false; }: - c3:COLON { print( c3 ); } - (strOptExprPair - ( c4:COMMA { print( c4 ); } strOptExprPair)* - )? - )? - )? - ( c5:COLON { print( c5 ); } - stringConst - ( c6:COMMA { print( c6 ); } - stringConst - )* - )? - rp:RPAREN { print( rp ); } - ) - ; - -strOptExprPair - : stringConst - ( - l:LPAREN { print( l ); } - expr - r:RPAREN { print( r ); } - )? - ; - -binaryOperator - : ASSIGN - | DIV_ASSIGN - | PLUS_ASSIGN - | MINUS_ASSIGN - | STAR_ASSIGN - | MOD_ASSIGN - | RSHIFT_ASSIGN - | LSHIFT_ASSIGN - | BAND_ASSIGN - | BOR_ASSIGN - | BXOR_ASSIGN - | LOR - | LAND - | BOR - | BXOR - | BAND - | EQUAL - | NOT_EQUAL - | LT - | LTE - | GT - | GTE - | LSHIFT - | RSHIFT - | PLUS - | MINUS - | STAR - | DIV - | MOD - | NCommaExpr - ; - -binaryExpr - : b:binaryOperator - // no rules allowed as roots, so here I manually get - // the first and second children of the binary operator - // and then print them out in the right order - { TNode e1, e2; - e1 = (TNode) b.getFirstChild(); - e2 = (TNode) e1.getNextSibling(); - expr( e1 ); - print( b ); - expr( e2 ); - } - - ; - - -conditionalExpr - : #( q:QUESTION - expr { print( q ); } - ( expr )? - c:COLON { print( c ); } - expr - ) - ; - - -castExpr - : #( - c:NCast { print( c ); } - typeName - rp:RPAREN { print( rp ); } - expr - ) - ; - - -typeName - : specifierQualifierList (nonemptyAbstractDeclarator)? - ; - -nonemptyAbstractDeclarator - : #( NNonemptyAbstractDeclarator - ( pointerGroup - ( (lp1:LPAREN { print( lp1 ); } - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - rp1:RPAREN { print( rp1 ); } - ) - | ( - lb1:LBRACKET { print( lb1 ); } - (expr)? - rb1:RBRACKET { print( rb1 ); } - ) - )* - - | ( (lp2:LPAREN { print( lp2 ); } - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - rp2:RPAREN { print( rp2 ); } - ) - | ( - lb2:LBRACKET { print( lb2 ); } - (expr)? - rb2:RBRACKET { print( rb2 ); } - ) - )+ - ) - ) - ; - - - -unaryExpr - : #( i:INC { print( i ); } expr ) - | #( d:DEC { print( d ); } expr ) - | #( NUnaryExpr u:unaryOperator { print( u ); } expr) - | #( s:"sizeof" { print( s ); } - ( ( LPAREN typeName )=> - lps:LPAREN { print( lps ); } - typeName - rps:RPAREN { print( rps ); } - | expr - ) - ) - | #( a:"__alignof" { print( a ); } - ( ( LPAREN typeName )=> - lpa:LPAREN { print( lpa ); } - typeName - rpa:RPAREN { print( rpa ); } - | expr - ) - ) - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - unaryOperator - : BAND - | STAR - | PLUS - | MINUS - | BNOT - | LNOT - | LAND - | "__real" - | "__imag" - ; - - -postfixExpr - : #( NPostfixExpr - primaryExpr - ( a:PTR b:ID { print( a ); print( b ); } - | c:DOT d:ID { print( c ); print( d ); } - | #( n:NFunctionCallArgs { print( n ); } - (argExprList)? - rp:RPAREN { print( rp ); } - ) - | lb:LBRACKET { print( lb ); } - expr - rb:RBRACKET { print( rb ); } - | f:INC { print( f ); } - | g:DEC { print( g ); } - )+ - ) - ; - - - -primaryExpr - : i:ID { print( i ); } - | n:Number { print( n ); } - | charConst - | stringConst - -// JTC: -// ID should catch the enumerator -// leaving it in gives ambiguous err -// | enumerator - - | #( eg:NExpressionGroup { print( eg ); } - expr { print( ")" ); } - ) - ; - - - -argExprList - : expr ( {print( "," );} expr )* - ; - - - -protected -charConst - : c:CharLiteral { print( c ); } - ; - - -protected -stringConst - : #( NStringSeq - ( - s:StringLiteral { print( s ); } - )+ - ) - ; - - -protected -intConst - : IntOctalConst - | LongOctalConst - | UnsignedOctalConst - | IntIntConst - | LongIntConst - | UnsignedIntConst - | IntHexConst - | LongHexConst - | UnsignedHexConst - ; - - -protected -floatConst - : FloatDoubleConst - | DoubleDoubleConst - | LongDoubleConst - ; - - - - - - - - - - diff --git a/app/preproc/WEmitter.java b/app/preproc/WEmitter.java deleted file mode 100644 index e80b46488..000000000 --- a/app/preproc/WEmitter.java +++ /dev/null @@ -1,6689 +0,0 @@ -// $ANTLR 2.7.2: "expandedWEmitter.g" -> "WEmitter.java"$ - -package processing.app.preproc; -import processing.app.*; -import java.io.*; -import java.util.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; - -import antlr.TreeParser; -import antlr.Token; -import antlr.collections.AST; -import antlr.RecognitionException; -import antlr.ANTLRException; -import antlr.NoViableAltException; -import antlr.MismatchedTokenException; -import antlr.SemanticException; -import antlr.collections.impl.BitSet; -import antlr.ASTPair; -import antlr.collections.impl.ASTArray; - - -public class WEmitter extends antlr.TreeParser implements WEmitterTokenTypes - { - - - -int tabs = 0; -PrintStream currentOutput = System.out; -int lineNum = 1; -String currentSource = ""; -LineObject trueSourceFile; -final int lineDirectiveThreshold = Integer.MAX_VALUE; -PreprocessorInfoChannel preprocessorInfoChannel = null; -Stack sourceFiles = new Stack(); - -WEmitter( PreprocessorInfoChannel preprocChannel ) -{ - preprocessorInfoChannel = preprocChannel; -} - - -public void setOut(PrintStream out) { - this.currentOutput = out; -} - -boolean childContains(AST ast, String childName) { - AST child = ast.getFirstChild(); - AST childchild; - while (child != null) { - //System.out.println(child.getText()); - if (child.getText().equals(childName)) { - // debug.println("getChild: found:" + name(ast)); - return true; - } - if(child.getFirstChild() != null) { - if(childContains(child, childName)) { - return true; - } - } - child = child.getNextSibling(); - } - return false; -} - -public void printDeclarations(AST ast) throws RunnerException { - if (ast == null) { - return; - } - - /*if(!childContains(ast, "serialEvent")) { - currentOutput.print("void serialEvent() {}"); - }*/ - if(!childContains(ast, "setup")) { - currentOutput.print("void setup() {}"); - } - if(!childContains(ast, "loop")) { - currentOutput.print("void loop() {}"); - } -} - - -void initializePrinting() -{ - Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber( new Integer(1) ); - printPreprocs(preprocs); -/* if ( currentSource.equals("") ) { - trueSourceFile = new LineObject(currentSource); - currentOutput.println("# 1 \"" + currentSource + "\"\n"); - sourceFiles.push(trueSourceFile); - } -*/ -} - -void finalizePrinting() { - // flush any leftover preprocessing instructions to the stream - - printPreprocs( - preprocessorInfoChannel.extractLinesPrecedingTokenNumber( - new Integer( preprocessorInfoChannel.getMaxTokenNumber() + 1 ) )); - //print a newline so file ends at a new line - currentOutput.println(); -} - -void printPreprocs( Vector preprocs ) -{ - // if there was a preprocessingDirective previous to this token then - // print a newline and the directive, line numbers handled later - if ( preprocs.size() > 0 ) { - if ( trueSourceFile != null ) { - currentOutput.println(); //make sure we're starting a new line unless this is the first line directive - } - lineNum++; - Enumeration e = preprocs.elements(); - while (e.hasMoreElements()) - { - Object o = e.nextElement(); - if ( o.getClass().getName().equals("LineObject") ) { - LineObject l = (LineObject) o; - - // we always return to the trueSourceFile, we never enter it from another file - // force it to be returning if in fact we aren't currently in trueSourceFile - if (( trueSourceFile != null ) //trueSource exists - && ( !currentSource.equals(trueSourceFile.getSource()) ) //currently not in trueSource - && ( trueSourceFile.getSource().equals(l.getSource()) ) ) { //returning to trueSource - l.setEnteringFile( false ); - l.setReturningToFile( true ); - } - - - // print the line directive - currentOutput.println(l); - lineNum = l.getLine(); - currentSource = l.getSource(); - - - // the very first line directive always represents the true sourcefile - if ( trueSourceFile == null ) { - trueSourceFile = new LineObject(currentSource); - sourceFiles.push(trueSourceFile); - } - - // keep our own stack of files entered - if ( l.getEnteringFile() ) { - sourceFiles.push(l); - } - - // if returning to a file, pop the exited files off the stack - if ( l.getReturningToFile() ) { - LineObject top = (LineObject) sourceFiles.peek(); - while (( top != trueSourceFile ) && (! l.getSource().equals(top.getSource()) )) { - sourceFiles.pop(); - top = (LineObject) sourceFiles.peek(); - } - } - } - else { // it was a #pragma or such - currentOutput.println(o); - lineNum++; - } - } - } - -} - -void print( TNode t ) { - int tLineNum = t.getLocalLineNum(); - if ( tLineNum == 0 ) tLineNum = lineNum; - - Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber((Integer)t.getAttribute("tokenNumber")); - printPreprocs(preprocs); - - if ( (lineNum != tLineNum) ) { - // we know we'll be newlines or a line directive or it probably - // is just the case that this token is on the next line - // either way start a new line and indent it - currentOutput.println(); - lineNum++; - printTabs(); - } - - if ( lineNum == tLineNum ){ - // do nothing special, we're at the right place - } - else { - int diff = tLineNum - lineNum; - if ( lineNum < tLineNum ) { - // print out the blank lines to bring us up to right line number - for ( ; lineNum < tLineNum ; lineNum++ ) { - currentOutput.println(); - } - printTabs(); - } - else { // just reset lineNum - lineNum = tLineNum; - } - } - currentOutput.print( t.getText() + " " ); -} - - -/* This was my attempt at being smart about line numbers - It didn't work quite right but I don't know why, I didn't - have enough test cases. Worked ok compiling rcs and ghostscript -*/ -void printAddingLineDirectives( TNode t ) { - int tLineNum = t.getLocalLineNum(); - String tSource = (String) t.getAttribute("source"); - - if ( tSource == null ) tSource = currentSource; - if ( tLineNum == 0 ) tLineNum = lineNum; - - Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber((Integer)t.getAttribute("tokenNumber")); - printPreprocs(preprocs); - - if ( (lineNum != tLineNum) || !currentSource.equals(tSource) ) { - // we know we'll be newlines or a line directive or it probably - // is just the case that this token is on the next line - // either way start a new line and indent it - currentOutput.println(); - lineNum++; - printTabs(); - } - - if ( ( lineNum == tLineNum ) && ( currentSource.equals(tSource) ) ){ - // do nothing special, we're at the right place - } - else if ( currentSource.equals(tSource) ) { - int diff = tLineNum - lineNum; - if (diff > 0 && diff < lineDirectiveThreshold) { - // print out the blank lines to bring us up to right line number - for ( ; lineNum < tLineNum ; lineNum++ ) { - currentOutput.println(); - } - } - else { // print line directive to get us to right line number - // preserve flags 3 and 4 if present in current file - if ( ! sourceFiles.empty() ) { - LineObject l = (LineObject) sourceFiles.peek(); - StringBuffer tFlags = new StringBuffer(""); - if (l.getSystemHeader()) { - tFlags.append(" 3"); - } - if (l.getTreatAsC()) { - tFlags.append(" 4"); - } - currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + tFlags.toString()); - lineNum = tLineNum; - } - } - - printTabs(); - } - else { // different source - Enumeration sources = sourceFiles.elements(); - // see if we're returning to a file we entered earlier - boolean returningToEarlierFile = false; - while (sources.hasMoreElements()) { - LineObject l = (LineObject) sources.nextElement(); - if (l.getSource().equals(tSource)) { - returningToEarlierFile = true; - break; - } - } - if (returningToEarlierFile) { - // pop off the files we're exiting, but never pop the trueSourceFile - LineObject l = (LineObject) sourceFiles.peek(); - while ( ( l != trueSourceFile ) &&(! l.getSource().equals(tSource) ) ) { - sourceFiles.pop(); - l = (LineObject) sourceFiles.peek(); - } - - // put in the return flag, plus others as needed - StringBuffer tFlags = new StringBuffer(" 2"); - if (l.getSystemHeader()) { - tFlags.append(" 3"); - } - if (l.getTreatAsC()) { - tFlags.append(" 4"); - } - - currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + tFlags); - lineNum = tLineNum; - currentSource = tSource; - printTabs(); - } - else { // entering a file that wasn't in the original source - // pretend we're entering it from top of stack - currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + " 1"); - lineNum = tLineNum; - currentSource = tSource; - printTabs(); - } - } - currentOutput.print( t.getText() + " " ); -} - -/** It is not ok to print newlines from the String passed in as -it will screw up the line number handling **/ -void print( String s ) { - currentOutput.print( s + " " ); -} - -void printTabs() { - for ( int i = 0; i< tabs; i++ ) { - currentOutput.print( "\t" ); - } -} - -void commaSep( TNode t ) { - print( t ); - if ( t.getNextSibling() != null ) { - print( "," ); - } -} - - int traceDepth = 0; - public void reportError(RecognitionException ex) { - if ( ex != null) { - System.err.println("ANTLR Tree Parsing RecognitionException Error: " + ex.getClass().getName() + " " + ex ); - ex.printStackTrace(System.err); - } - } - public void reportError(NoViableAltException ex) { - System.err.println("ANTLR Tree Parsing NoViableAltException Error: " + ex.toString()); - TNode.printTree( ex.node ); - ex.printStackTrace(System.err); - } - public void reportError(MismatchedTokenException ex) { - if ( ex != null) { - TNode.printTree( ex.node ); - System.err.println("ANTLR Tree Parsing MismatchedTokenException Error: " + ex ); - ex.printStackTrace(System.err); - } - } - public void reportError(String s) { - System.err.println("ANTLR Error from String: " + s); - } - public void reportWarning(String s) { - System.err.println("ANTLR Warning from String: " + s); - } - protected void match(AST t, int ttype) throws MismatchedTokenException { - //System.out.println("match("+ttype+"); cursor is "+t); - super.match(t, ttype); - } - public void match(AST t, BitSet b) throws MismatchedTokenException { - //System.out.println("match("+b+"); cursor is "+t); - super.match(t, b); - } - protected void matchNot(AST t, int ttype) throws MismatchedTokenException { - //System.out.println("matchNot("+ttype+"); cursor is "+t); - super.matchNot(t, ttype); - } - public void traceIn(String rname, AST t) { - traceDepth += 1; - for (int x=0; x=1 ) { break _loop5; } else {throw new NoViableAltException(_t);} - } - - _cnt5++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void externalDef(AST _t) throws RecognitionException { - - TNode externalDef_AST_in = (TNode)_t; - TNode s = null; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NDeclaration: - { - declaration(_t); - _t = _retTree; - break; - } - case NFunctionDef: - { - functionDef(_t); - _t = _retTree; - break; - } - case LITERAL_asm: - { - asm_expr(_t); - _t = _retTree; - break; - } - case NTypeMissing: - { - typelessDeclaration(_t); - _t = _retTree; - break; - } - case SEMI: - { - s = (TNode)_t; - match(_t,SEMI); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( s ); - } - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void declaration(AST _t) throws RecognitionException { - - TNode declaration_AST_in = (TNode)_t; - TNode s = null; - - try { // for error handling - AST __t13 = _t; - TNode tmp1_AST_in = (TNode)_t; - match(_t,NDeclaration); - _t = _t.getFirstChild(); - declSpecifiers(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NInitDecl: - { - initDeclList(_t); - _t = _retTree; - break; - } - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - { - int _cnt16=0; - _loop16: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==SEMI)) { - s = (TNode)_t; - match(_t,SEMI); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( s ); - } - } - else { - if ( _cnt16>=1 ) { break _loop16; } else {throw new NoViableAltException(_t);} - } - - _cnt16++; - } while (true); - } - _t = __t13; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void functionDef(AST _t) throws RecognitionException { - - TNode functionDef_AST_in = (TNode)_t; - TNode v = null; - - try { // for error handling - AST __t123 = _t; - TNode tmp2_AST_in = (TNode)_t; - match(_t,NFunctionDef); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_extern: - case LITERAL_static: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case NTypedefName: - case LITERAL_inline: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - functionDeclSpecifiers(_t); - _t = _retTree; - break; - } - case NDeclarator: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - declarator(_t); - _t = _retTree; - { - _loop126: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NDeclaration: - { - declaration(_t); - _t = _retTree; - break; - } - case VARARGS: - { - v = (TNode)_t; - match(_t,VARARGS); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( v ); - } - break; - } - default: - { - break _loop126; - } - } - } while (true); - } - compoundStatement(_t); - _t = _retTree; - _t = __t123; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void asm_expr(AST _t) throws RecognitionException { - - TNode asm_expr_AST_in = (TNode)_t; - TNode a = null; - TNode v = null; - TNode lc = null; - TNode rc = null; - TNode s = null; - - try { // for error handling - AST __t10 = _t; - a = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_asm); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( a ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_volatile: - { - v = (TNode)_t; - match(_t,LITERAL_volatile); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( v ); - } - break; - } - case LCURLY: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - lc = (TNode)_t; - match(_t,LCURLY); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( lc ); tabs++; - } - expr(_t); - _t = _retTree; - rc = (TNode)_t; - match(_t,RCURLY); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - tabs--; print( rc ); - } - s = (TNode)_t; - match(_t,SEMI); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( s ); - } - _t = __t10; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void typelessDeclaration(AST _t) throws RecognitionException { - - TNode typelessDeclaration_AST_in = (TNode)_t; - TNode s = null; - - try { // for error handling - AST __t8 = _t; - TNode tmp3_AST_in = (TNode)_t; - match(_t,NTypeMissing); - _t = _t.getFirstChild(); - initDeclList(_t); - _t = _retTree; - s = (TNode)_t; - match(_t,SEMI); - _t = _t.getNextSibling(); - _t = __t8; - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( s ); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void initDeclList(AST _t) throws RecognitionException { - - TNode initDeclList_AST_in = (TNode)_t; - - try { // for error handling - initDecl(_t); - _t = _retTree; - { - _loop76: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NInitDecl)) { - if ( inputState.guessing==0 ) { - print( "," ); - } - initDecl(_t); - _t = _retTree; - } - else { - break _loop76; - } - - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void expr(AST _t) throws RecognitionException { - - TNode expr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ASSIGN: - case STAR: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case NCommaExpr: - { - binaryExpr(_t); - _t = _retTree; - break; - } - case QUESTION: - { - conditionalExpr(_t); - _t = _retTree; - break; - } - case NCast: - { - castExpr(_t); - _t = _retTree; - break; - } - case INC: - case DEC: - case LITERAL_sizeof: - case NUnaryExpr: - case LITERAL___alignof: - { - unaryExpr(_t); - _t = _retTree; - break; - } - case NPostfixExpr: - { - postfixExpr(_t); - _t = _retTree; - break; - } - case ID: - case CharLiteral: - case NExpressionGroup: - case NStringSeq: - case Number: - { - primaryExpr(_t); - _t = _retTree; - break; - } - case NEmptyExpression: - { - emptyExpr(_t); - _t = _retTree; - break; - } - case LPAREN: - { - compoundStatementExpr(_t); - _t = _retTree; - break; - } - case NInitializer: - case NLcurlyInitializer: - { - initializer(_t); - _t = _retTree; - break; - } - case NRangeExpr: - { - rangeExpr(_t); - _t = _retTree; - break; - } - case NGnuAsmExpr: - { - gnuAsmExpr(_t); - _t = _retTree; - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void declSpecifiers(AST _t) throws RecognitionException { - - TNode declSpecifiers_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt19=0; - _loop19: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_typedef: - case LITERAL_auto: - case LITERAL_register: - case LITERAL_extern: - case LITERAL_static: - case LITERAL_inline: - { - storageClassSpecifier(_t); - _t = _retTree; - break; - } - case LITERAL_volatile: - case LITERAL_const: - { - typeQualifier(_t); - _t = _retTree; - break; - } - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case NTypedefName: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - typeSpecifier(_t); - _t = _retTree; - break; - } - default: - { - if ( _cnt19>=1 ) { break _loop19; } else {throw new NoViableAltException(_t);} - } - } - _cnt19++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void storageClassSpecifier(AST _t) throws RecognitionException { - - TNode storageClassSpecifier_AST_in = (TNode)_t; - TNode a = null; - TNode b = null; - TNode c = null; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_auto: - { - a = (TNode)_t; - match(_t,LITERAL_auto); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( a ); - } - break; - } - case LITERAL_register: - { - b = (TNode)_t; - match(_t,LITERAL_register); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( b ); - } - break; - } - case LITERAL_typedef: - { - c = (TNode)_t; - match(_t,LITERAL_typedef); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c ); - } - break; - } - case LITERAL_extern: - case LITERAL_static: - case LITERAL_inline: - { - functionStorageClassSpecifier(_t); - _t = _retTree; - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void typeQualifier(AST _t) throws RecognitionException { - - TNode typeQualifier_AST_in = (TNode)_t; - TNode a = null; - TNode b = null; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_const: - { - a = (TNode)_t; - match(_t,LITERAL_const); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( a ); - } - break; - } - case LITERAL_volatile: - { - b = (TNode)_t; - match(_t,LITERAL_volatile); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( b ); - } - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void typeSpecifier(AST _t) throws RecognitionException { - - TNode typeSpecifier_AST_in = (TNode)_t; - TNode a = null; - TNode b = null; - TNode c = null; - TNode d = null; - TNode e = null; - TNode f = null; - TNode g = null; - TNode h = null; - TNode i = null; - TNode j = null; - TNode k = null; - TNode l = null; - TNode m = null; - TNode n = null; - TNode lp = null; - TNode rp = null; - TNode p = null; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_void: - { - a = (TNode)_t; - match(_t,LITERAL_void); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( a ); - } - break; - } - case LITERAL_char: - { - b = (TNode)_t; - match(_t,LITERAL_char); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( b ); - } - break; - } - case LITERAL_short: - { - c = (TNode)_t; - match(_t,LITERAL_short); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c ); - } - break; - } - case LITERAL_int: - { - d = (TNode)_t; - match(_t,LITERAL_int); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( d ); - } - break; - } - case LITERAL_long: - { - e = (TNode)_t; - match(_t,LITERAL_long); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( e ); - } - break; - } - case LITERAL_float: - { - f = (TNode)_t; - match(_t,LITERAL_float); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( f ); - } - break; - } - case LITERAL_double: - { - g = (TNode)_t; - match(_t,LITERAL_double); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( g ); - } - break; - } - case LITERAL_signed: - { - h = (TNode)_t; - match(_t,LITERAL_signed); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( h ); - } - break; - } - case LITERAL_unsigned: - { - i = (TNode)_t; - match(_t,LITERAL_unsigned); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( i ); - } - break; - } - case LITERAL_byte: - { - j = (TNode)_t; - match(_t,LITERAL_byte); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( j ); - } - break; - } - case LITERAL_boolean: - { - k = (TNode)_t; - match(_t,LITERAL_boolean); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( k ); - } - break; - } - case LITERAL_Servo: - { - l = (TNode)_t; - match(_t,LITERAL_Servo); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( l ); - } - break; - } - case LITERAL_Wire: - { - m = (TNode)_t; - match(_t,LITERAL_Wire); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( m ); - } - break; - } - case LITERAL_struct: - { - structSpecifier(_t); - _t = _retTree; - { - _loop25: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NAsmAttribute||_t.getType()==LITERAL___attribute)) { - attributeDecl(_t); - _t = _retTree; - } - else { - break _loop25; - } - - } while (true); - } - break; - } - case LITERAL_union: - { - unionSpecifier(_t); - _t = _retTree; - { - _loop27: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NAsmAttribute||_t.getType()==LITERAL___attribute)) { - attributeDecl(_t); - _t = _retTree; - } - else { - break _loop27; - } - - } while (true); - } - break; - } - case LITERAL_enum: - { - enumSpecifier(_t); - _t = _retTree; - break; - } - case NTypedefName: - { - typedefName(_t); - _t = _retTree; - break; - } - case LITERAL_typeof: - { - AST __t28 = _t; - n = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_typeof); - _t = _t.getFirstChild(); - lp = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( n ); print( lp ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case NTypedefName: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - typeName(_t); - _t = _retTree; - break; - } - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - expr(_t); - _t = _retTree; - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - rp = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( rp ); - } - _t = __t28; - _t = _t.getNextSibling(); - break; - } - case LITERAL___complex: - { - p = (TNode)_t; - match(_t,LITERAL___complex); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( p ); - } - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void functionStorageClassSpecifier(AST _t) throws RecognitionException { - - TNode functionStorageClassSpecifier_AST_in = (TNode)_t; - TNode a = null; - TNode b = null; - TNode c = null; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_extern: - { - a = (TNode)_t; - match(_t,LITERAL_extern); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( a ); - } - break; - } - case LITERAL_static: - { - b = (TNode)_t; - match(_t,LITERAL_static); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( b ); - } - break; - } - case LITERAL_inline: - { - c = (TNode)_t; - match(_t,LITERAL_inline); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c ); - } - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void structSpecifier(AST _t) throws RecognitionException { - - TNode structSpecifier_AST_in = (TNode)_t; - TNode a = null; - - try { // for error handling - AST __t35 = _t; - a = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_struct); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( a ); - } - structOrUnionBody(_t); - _t = _retTree; - _t = __t35; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void attributeDecl(AST _t) throws RecognitionException { - - TNode attributeDecl_AST_in = (TNode)_t; - TNode a = null; - TNode b = null; - TNode n = null; - TNode lp = null; - TNode rp = null; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL___attribute: - { - AST __t70 = _t; - a = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL___attribute); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( a ); - } - { - _loop72: - do { - if (_t==null) _t=ASTNULL; - if (((_t.getType() >= LITERAL_typedef && _t.getType() <= LITERAL___imag))) { - b = (TNode)_t; - if ( _t==null ) throw new MismatchedTokenException(); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( b ); - } - } - else { - break _loop72; - } - - } while (true); - } - _t = __t70; - _t = _t.getNextSibling(); - break; - } - case NAsmAttribute: - { - AST __t73 = _t; - n = _t==ASTNULL ? null :(TNode)_t; - match(_t,NAsmAttribute); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( n ); - } - lp = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( lp ); - } - expr(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( ")" ); - } - rp = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( rp ); - } - _t = __t73; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void unionSpecifier(AST _t) throws RecognitionException { - - TNode unionSpecifier_AST_in = (TNode)_t; - TNode a = null; - - try { // for error handling - AST __t37 = _t; - a = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_union); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( a ); - } - structOrUnionBody(_t); - _t = _retTree; - _t = __t37; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void enumSpecifier(AST _t) throws RecognitionException { - - TNode enumSpecifier_AST_in = (TNode)_t; - TNode a = null; - TNode i = null; - TNode lc = null; - TNode rc = null; - - try { // for error handling - AST __t61 = _t; - a = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_enum); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( a ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - { - i = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( i ); - } - break; - } - case 3: - case LCURLY: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LCURLY: - { - lc = (TNode)_t; - match(_t,LCURLY); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( lc ); tabs++; - } - enumList(_t); - _t = _retTree; - rc = (TNode)_t; - match(_t,RCURLY); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - tabs--; print( rc ); - } - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t61; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void typedefName(AST _t) throws RecognitionException { - - TNode typedefName_AST_in = (TNode)_t; - TNode i = null; - - try { // for error handling - AST __t33 = _t; - TNode tmp4_AST_in = (TNode)_t; - match(_t,NTypedefName); - _t = _t.getFirstChild(); - i = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( i ); - } - _t = __t33; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void typeName(AST _t) throws RecognitionException { - - TNode typeName_AST_in = (TNode)_t; - - try { // for error handling - specifierQualifierList(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NNonemptyAbstractDeclarator: - { - nonemptyAbstractDeclarator(_t); - _t = _retTree; - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void structOrUnionBody(AST _t) throws RecognitionException { - - TNode structOrUnionBody_AST_in = (TNode)_t; - TNode i1 = null; - TNode lc1 = null; - TNode rc1 = null; - TNode lc2 = null; - TNode rc2 = null; - TNode i2 = null; - - try { // for error handling - { - boolean synPredMatched41 = false; - if (((_t.getType()==ID))) { - AST __t41 = _t; - synPredMatched41 = true; - inputState.guessing++; - try { - { - TNode tmp5_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - TNode tmp6_AST_in = (TNode)_t; - match(_t,LCURLY); - _t = _t.getNextSibling(); - } - } - catch (RecognitionException pe) { - synPredMatched41 = false; - } - _t = __t41; - inputState.guessing--; - } - if ( synPredMatched41 ) { - i1 = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - lc1 = (TNode)_t; - match(_t,LCURLY); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( i1 ); print ( "{" ); tabs++; - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case NTypedefName: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - structDeclarationList(_t); - _t = _retTree; - break; - } - case RCURLY: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - rc1 = (TNode)_t; - match(_t,RCURLY); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - tabs--; print( rc1 ); - } - } - else if ((_t.getType()==LCURLY)) { - lc2 = (TNode)_t; - match(_t,LCURLY); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( lc2 ); tabs++; - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case NTypedefName: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - structDeclarationList(_t); - _t = _retTree; - break; - } - case RCURLY: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - rc2 = (TNode)_t; - match(_t,RCURLY); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - tabs--; print( rc2 ); - } - } - else if ((_t.getType()==ID)) { - i2 = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( i2 ); - } - } - else { - throw new NoViableAltException(_t); - } - - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void structDeclarationList(AST _t) throws RecognitionException { - - TNode structDeclarationList_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt46=0; - _loop46: - do { - if (_t==null) _t=ASTNULL; - if ((_tokenSet_1.member(_t.getType()))) { - structDeclaration(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( ";" ); - } - } - else { - if ( _cnt46>=1 ) { break _loop46; } else {throw new NoViableAltException(_t);} - } - - _cnt46++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void structDeclaration(AST _t) throws RecognitionException { - - TNode structDeclaration_AST_in = (TNode)_t; - - try { // for error handling - specifierQualifierList(_t); - _t = _retTree; - structDeclaratorList(_t); - _t = _retTree; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void specifierQualifierList(AST _t) throws RecognitionException { - - TNode specifierQualifierList_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt50=0; - _loop50: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case NTypedefName: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - typeSpecifier(_t); - _t = _retTree; - break; - } - case LITERAL_volatile: - case LITERAL_const: - { - typeQualifier(_t); - _t = _retTree; - break; - } - default: - { - if ( _cnt50>=1 ) { break _loop50; } else {throw new NoViableAltException(_t);} - } - } - _cnt50++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void structDeclaratorList(AST _t) throws RecognitionException { - - TNode structDeclaratorList_AST_in = (TNode)_t; - - try { // for error handling - structDeclarator(_t); - _t = _retTree; - { - _loop53: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NStructDeclarator)) { - if ( inputState.guessing==0 ) { - print(","); - } - structDeclarator(_t); - _t = _retTree; - } - else { - break _loop53; - } - - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void structDeclarator(AST _t) throws RecognitionException { - - TNode structDeclarator_AST_in = (TNode)_t; - TNode c = null; - - try { // for error handling - AST __t55 = _t; - TNode tmp7_AST_in = (TNode)_t; - match(_t,NStructDeclarator); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NDeclarator: - { - declarator(_t); - _t = _retTree; - break; - } - case 3: - case COLON: - case NAsmAttribute: - case LITERAL___attribute: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case COLON: - { - c = (TNode)_t; - match(_t,COLON); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c ); - } - expr(_t); - _t = _retTree; - break; - } - case 3: - case NAsmAttribute: - case LITERAL___attribute: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - { - _loop59: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NAsmAttribute||_t.getType()==LITERAL___attribute)) { - attributeDecl(_t); - _t = _retTree; - } - else { - break _loop59; - } - - } while (true); - } - _t = __t55; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void declarator(AST _t) throws RecognitionException { - - TNode declarator_AST_in = (TNode)_t; - TNode id = null; - TNode lp = null; - TNode rp = null; - TNode n = null; - TNode r = null; - TNode lb = null; - TNode rb = null; - - try { // for error handling - AST __t105 = _t; - TNode tmp8_AST_in = (TNode)_t; - match(_t,NDeclarator); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NPointerGroup: - { - pointerGroup(_t); - _t = _retTree; - break; - } - case ID: - case LPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - { - id = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( id ); - } - break; - } - case LPAREN: - { - lp = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( lp ); - } - declarator(_t); - _t = _retTree; - rp = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( rp ); - } - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - { - _loop113: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NParameterTypeList: - { - AST __t109 = _t; - n = _t==ASTNULL ? null :(TNode)_t; - match(_t,NParameterTypeList); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( n ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NParameterDeclaration: - { - parameterTypeList(_t); - _t = _retTree; - break; - } - case ID: - case RPAREN: - { - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - { - idList(_t); - _t = _retTree; - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - r = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( r ); - } - _t = __t109; - _t = _t.getNextSibling(); - break; - } - case LBRACKET: - { - lb = (TNode)_t; - match(_t,LBRACKET); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( lb ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - expr(_t); - _t = _retTree; - break; - } - case RBRACKET: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - rb = (TNode)_t; - match(_t,RBRACKET); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( rb ); - } - break; - } - default: - { - break _loop113; - } - } - } while (true); - } - _t = __t105; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void enumList(AST _t) throws RecognitionException { - - TNode enumList_AST_in = (TNode)_t; - - try { // for error handling - enumerator(_t); - _t = _retTree; - { - _loop66: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==ID)) { - if ( inputState.guessing==0 ) { - print(","); - } - enumerator(_t); - _t = _retTree; - } - else { - break _loop66; - } - - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void enumerator(AST _t) throws RecognitionException { - - TNode enumerator_AST_in = (TNode)_t; - TNode i = null; - TNode b = null; - - try { // for error handling - i = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( i ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ASSIGN: - { - b = (TNode)_t; - match(_t,ASSIGN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( b ); - } - expr(_t); - _t = _retTree; - break; - } - case RCURLY: - case ID: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void initDecl(AST _t) throws RecognitionException { - - TNode initDecl_AST_in = (TNode)_t; - TNode a = null; - TNode b = null; - String declName = ""; - - try { // for error handling - AST __t78 = _t; - TNode tmp9_AST_in = (TNode)_t; - match(_t,NInitDecl); - _t = _t.getFirstChild(); - declarator(_t); - _t = _retTree; - { - _loop80: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NAsmAttribute||_t.getType()==LITERAL___attribute)) { - attributeDecl(_t); - _t = _retTree; - } - else { - break _loop80; - } - - } while (true); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ASSIGN: - { - a = (TNode)_t; - match(_t,ASSIGN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( a ); - } - initializer(_t); - _t = _retTree; - break; - } - case COLON: - { - b = (TNode)_t; - match(_t,COLON); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( b ); - } - expr(_t); - _t = _retTree; - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t78; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void initializer(AST _t) throws RecognitionException { - - TNode initializer_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NInitializer: - { - AST __t92 = _t; - TNode tmp10_AST_in = (TNode)_t; - match(_t,NInitializer); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NInitializerElementLabel: - { - initializerElementLabel(_t); - _t = _retTree; - break; - } - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - expr(_t); - _t = _retTree; - _t = __t92; - _t = _t.getNextSibling(); - break; - } - case NLcurlyInitializer: - { - lcurlyInitializer(_t); - _t = _retTree; - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void pointerGroup(AST _t) throws RecognitionException { - - TNode pointerGroup_AST_in = (TNode)_t; - TNode a = null; - - try { // for error handling - AST __t83 = _t; - TNode tmp11_AST_in = (TNode)_t; - match(_t,NPointerGroup); - _t = _t.getFirstChild(); - { - int _cnt87=0; - _loop87: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==STAR)) { - a = (TNode)_t; - match(_t,STAR); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( a ); - } - { - _loop86: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==LITERAL_volatile||_t.getType()==LITERAL_const)) { - typeQualifier(_t); - _t = _retTree; - } - else { - break _loop86; - } - - } while (true); - } - } - else { - if ( _cnt87>=1 ) { break _loop87; } else {throw new NoViableAltException(_t);} - } - - _cnt87++; - } while (true); - } - _t = __t83; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void idList(AST _t) throws RecognitionException { - - TNode idList_AST_in = (TNode)_t; - TNode i = null; - TNode c = null; - TNode id = null; - - try { // for error handling - i = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( i ); - } - { - _loop90: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==COMMA)) { - c = (TNode)_t; - match(_t,COMMA); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c ); - } - id = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( id ); - } - } - else { - break _loop90; - } - - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void initializerElementLabel(AST _t) throws RecognitionException { - - TNode initializerElementLabel_AST_in = (TNode)_t; - TNode l = null; - TNode r = null; - TNode a1 = null; - TNode i1 = null; - TNode c = null; - TNode d = null; - TNode i2 = null; - TNode a2 = null; - - try { // for error handling - AST __t95 = _t; - TNode tmp12_AST_in = (TNode)_t; - match(_t,NInitializerElementLabel); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LBRACKET: - { - { - l = (TNode)_t; - match(_t,LBRACKET); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( l ); - } - expr(_t); - _t = _retTree; - r = (TNode)_t; - match(_t,RBRACKET); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( r ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ASSIGN: - { - a1 = (TNode)_t; - match(_t,ASSIGN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( a1 ); - } - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - } - break; - } - case ID: - { - i1 = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - c = (TNode)_t; - match(_t,COLON); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( i1 ); print( c ); - } - break; - } - case DOT: - { - d = (TNode)_t; - match(_t,DOT); - _t = _t.getNextSibling(); - i2 = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - a2 = (TNode)_t; - match(_t,ASSIGN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( d ); print( i2 ); print( a2 ); - } - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t95; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void lcurlyInitializer(AST _t) throws RecognitionException { - - TNode lcurlyInitializer_AST_in = (TNode)_t; - TNode n = null; - TNode rc = null; - - try { // for error handling - AST __t100 = _t; - n = _t==ASTNULL ? null :(TNode)_t; - match(_t,NLcurlyInitializer); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( n ); tabs++; - } - initializerList(_t); - _t = _retTree; - rc = (TNode)_t; - match(_t,RCURLY); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - tabs--; print( rc ); - } - _t = __t100; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void initializerList(AST _t) throws RecognitionException { - - TNode initializerList_AST_in = (TNode)_t; - TNode i = null; - - try { // for error handling - { - _loop103: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NInitializer||_t.getType()==NLcurlyInitializer)) { - i = _t==ASTNULL ? null : (TNode)_t; - initializer(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - commaSep( i ); - } - } - else { - break _loop103; - } - - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void parameterTypeList(AST _t) throws RecognitionException { - - TNode parameterTypeList_AST_in = (TNode)_t; - TNode c = null; - TNode s = null; - TNode v = null; - - try { // for error handling - { - int _cnt117=0; - _loop117: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NParameterDeclaration)) { - parameterDeclaration(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case COMMA: - { - c = (TNode)_t; - match(_t,COMMA); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c ); - } - break; - } - case SEMI: - { - s = (TNode)_t; - match(_t,SEMI); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( s ); - } - break; - } - case RPAREN: - case VARARGS: - case NParameterDeclaration: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - } - else { - if ( _cnt117>=1 ) { break _loop117; } else {throw new NoViableAltException(_t);} - } - - _cnt117++; - } while (true); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case VARARGS: - { - v = (TNode)_t; - match(_t,VARARGS); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( v ); - } - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void parameterDeclaration(AST _t) throws RecognitionException { - - TNode parameterDeclaration_AST_in = (TNode)_t; - - try { // for error handling - AST __t120 = _t; - TNode tmp13_AST_in = (TNode)_t; - match(_t,NParameterDeclaration); - _t = _t.getFirstChild(); - declSpecifiers(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NDeclarator: - { - declarator(_t); - _t = _retTree; - break; - } - case NNonemptyAbstractDeclarator: - { - nonemptyAbstractDeclarator(_t); - _t = _retTree; - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t120; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void nonemptyAbstractDeclarator(AST _t) throws RecognitionException { - - TNode nonemptyAbstractDeclarator_AST_in = (TNode)_t; - TNode lp1 = null; - TNode rp1 = null; - TNode lb1 = null; - TNode rb1 = null; - TNode lp2 = null; - TNode rp2 = null; - TNode lb2 = null; - TNode rb2 = null; - - try { // for error handling - AST __t195 = _t; - TNode tmp14_AST_in = (TNode)_t; - match(_t,NNonemptyAbstractDeclarator); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NPointerGroup: - { - pointerGroup(_t); - _t = _retTree; - { - _loop202: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LPAREN: - { - { - lp1 = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( lp1 ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NNonemptyAbstractDeclarator: - { - nonemptyAbstractDeclarator(_t); - _t = _retTree; - break; - } - case NParameterDeclaration: - { - parameterTypeList(_t); - _t = _retTree; - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - rp1 = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( rp1 ); - } - } - break; - } - case LBRACKET: - { - { - lb1 = (TNode)_t; - match(_t,LBRACKET); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( lb1 ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - expr(_t); - _t = _retTree; - break; - } - case RBRACKET: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - rb1 = (TNode)_t; - match(_t,RBRACKET); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( rb1 ); - } - } - break; - } - default: - { - break _loop202; - } - } - } while (true); - } - break; - } - case LPAREN: - case LBRACKET: - { - { - int _cnt208=0; - _loop208: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LPAREN: - { - { - lp2 = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( lp2 ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NNonemptyAbstractDeclarator: - { - nonemptyAbstractDeclarator(_t); - _t = _retTree; - break; - } - case NParameterDeclaration: - { - parameterTypeList(_t); - _t = _retTree; - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - rp2 = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( rp2 ); - } - } - break; - } - case LBRACKET: - { - { - lb2 = (TNode)_t; - match(_t,LBRACKET); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( lb2 ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - expr(_t); - _t = _retTree; - break; - } - case RBRACKET: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - rb2 = (TNode)_t; - match(_t,RBRACKET); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( rb2 ); - } - } - break; - } - default: - { - if ( _cnt208>=1 ) { break _loop208; } else {throw new NoViableAltException(_t);} - } - } - _cnt208++; - } while (true); - } - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t195; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void functionDeclSpecifiers(AST _t) throws RecognitionException { - - TNode functionDeclSpecifiers_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt129=0; - _loop129: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_extern: - case LITERAL_static: - case LITERAL_inline: - { - functionStorageClassSpecifier(_t); - _t = _retTree; - break; - } - case LITERAL_volatile: - case LITERAL_const: - { - typeQualifier(_t); - _t = _retTree; - break; - } - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case NTypedefName: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - typeSpecifier(_t); - _t = _retTree; - break; - } - default: - { - if ( _cnt129>=1 ) { break _loop129; } else {throw new NoViableAltException(_t);} - } - } - _cnt129++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void compoundStatement(AST _t) throws RecognitionException { - - TNode compoundStatement_AST_in = (TNode)_t; - TNode cs = null; - TNode rc = null; - - try { // for error handling - AST __t138 = _t; - cs = _t==ASTNULL ? null :(TNode)_t; - match(_t,NCompoundStatement); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( cs ); tabs++; - } - { - _loop140: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NDeclaration: - case LITERAL___label__: - { - declarationList(_t); - _t = _retTree; - break; - } - case NFunctionDef: - { - functionDef(_t); - _t = _retTree; - break; - } - default: - { - break _loop140; - } - } - } while (true); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case SEMI: - case LITERAL_while: - case LITERAL_do: - case LITERAL_for: - case LITERAL_goto: - case LITERAL_continue: - case LITERAL_break: - case LITERAL_return: - case LITERAL_case: - case LITERAL_default: - case LITERAL_if: - case LITERAL_switch: - case NStatementExpr: - case NCompoundStatement: - case NLabel: - { - statementList(_t); - _t = _retTree; - break; - } - case RCURLY: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - rc = (TNode)_t; - match(_t,RCURLY); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - tabs--; print( rc ); - } - _t = __t138; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void declarationList(AST _t) throws RecognitionException { - - TNode declarationList_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt132=0; - _loop132: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==LITERAL___label__)) { - localLabelDecl(_t); - _t = _retTree; - } - else if ((_t.getType()==NDeclaration)) { - declaration(_t); - _t = _retTree; - } - else { - if ( _cnt132>=1 ) { break _loop132; } else {throw new NoViableAltException(_t);} - } - - _cnt132++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void localLabelDecl(AST _t) throws RecognitionException { - - TNode localLabelDecl_AST_in = (TNode)_t; - TNode a = null; - TNode i = null; - - try { // for error handling - AST __t134 = _t; - a = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL___label__); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( a ); - } - { - int _cnt136=0; - _loop136: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==ID)) { - i = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - commaSep( i ); - } - } - else { - if ( _cnt136>=1 ) { break _loop136; } else {throw new NoViableAltException(_t);} - } - - _cnt136++; - } while (true); - } - if ( inputState.guessing==0 ) { - print( ";" ); - } - _t = __t134; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void statementList(AST _t) throws RecognitionException { - - TNode statementList_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt144=0; - _loop144: - do { - if (_t==null) _t=ASTNULL; - if ((_tokenSet_2.member(_t.getType()))) { - statement(_t); - _t = _retTree; - } - else { - if ( _cnt144>=1 ) { break _loop144; } else {throw new NoViableAltException(_t);} - } - - _cnt144++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void statement(AST _t) throws RecognitionException { - - TNode statement_AST_in = (TNode)_t; - - try { // for error handling - statementBody(_t); - _t = _retTree; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void statementBody(AST _t) throws RecognitionException { - - TNode statementBody_AST_in = (TNode)_t; - TNode s = null; - TNode w = null; - TNode d = null; - TNode f = null; - TNode g = null; - TNode c = null; - TNode b = null; - TNode r = null; - TNode ni = null; - TNode ca = null; - TNode de = null; - TNode i = null; - TNode e = null; - TNode sw = null; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case SEMI: - { - s = (TNode)_t; - match(_t,SEMI); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( s ); - } - break; - } - case NCompoundStatement: - { - compoundStatement(_t); - _t = _retTree; - break; - } - case NStatementExpr: - { - AST __t147 = _t; - TNode tmp15_AST_in = (TNode)_t; - match(_t,NStatementExpr); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( ";" ); - } - _t = __t147; - _t = _t.getNextSibling(); - break; - } - case LITERAL_while: - { - AST __t148 = _t; - w = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_while); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( w ); print( "(" ); - } - expr(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( ")" ); - } - statement(_t); - _t = _retTree; - _t = __t148; - _t = _t.getNextSibling(); - break; - } - case LITERAL_do: - { - AST __t149 = _t; - d = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_do); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( d ); - } - statement(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( " while ( " ); - } - expr(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( " );" ); - } - _t = __t149; - _t = _t.getNextSibling(); - break; - } - case LITERAL_for: - { - AST __t150 = _t; - f = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_for); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( f ); print( "(" ); - } - expr(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( ";" ); - } - expr(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( ";" ); - } - expr(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( ")" ); - } - statement(_t); - _t = _retTree; - _t = __t150; - _t = _t.getNextSibling(); - break; - } - case LITERAL_goto: - { - AST __t151 = _t; - g = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_goto); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( g ); - } - expr(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( ";" ); - } - _t = __t151; - _t = _t.getNextSibling(); - break; - } - case LITERAL_continue: - { - c = (TNode)_t; - match(_t,LITERAL_continue); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c ); print( ";" ); - } - break; - } - case LITERAL_break: - { - b = (TNode)_t; - match(_t,LITERAL_break); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( b ); print( ";" ); - } - break; - } - case LITERAL_return: - { - AST __t152 = _t; - r = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_return); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( r ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - expr(_t); - _t = _retTree; - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - if ( inputState.guessing==0 ) { - print( ";" ); - } - _t = __t152; - _t = _t.getNextSibling(); - break; - } - case NLabel: - { - AST __t154 = _t; - TNode tmp16_AST_in = (TNode)_t; - match(_t,NLabel); - _t = _t.getFirstChild(); - ni = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( ni ); print( ":" ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case SEMI: - case LITERAL_while: - case LITERAL_do: - case LITERAL_for: - case LITERAL_goto: - case LITERAL_continue: - case LITERAL_break: - case LITERAL_return: - case LITERAL_case: - case LITERAL_default: - case LITERAL_if: - case LITERAL_switch: - case NStatementExpr: - case NCompoundStatement: - case NLabel: - { - statement(_t); - _t = _retTree; - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t154; - _t = _t.getNextSibling(); - break; - } - case LITERAL_case: - { - AST __t156 = _t; - ca = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_case); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( ca ); - } - expr(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( ":" ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case SEMI: - case LITERAL_while: - case LITERAL_do: - case LITERAL_for: - case LITERAL_goto: - case LITERAL_continue: - case LITERAL_break: - case LITERAL_return: - case LITERAL_case: - case LITERAL_default: - case LITERAL_if: - case LITERAL_switch: - case NStatementExpr: - case NCompoundStatement: - case NLabel: - { - statement(_t); - _t = _retTree; - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t156; - _t = _t.getNextSibling(); - break; - } - case LITERAL_default: - { - AST __t158 = _t; - de = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_default); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( de ); print( ":" ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case SEMI: - case LITERAL_while: - case LITERAL_do: - case LITERAL_for: - case LITERAL_goto: - case LITERAL_continue: - case LITERAL_break: - case LITERAL_return: - case LITERAL_case: - case LITERAL_default: - case LITERAL_if: - case LITERAL_switch: - case NStatementExpr: - case NCompoundStatement: - case NLabel: - { - statement(_t); - _t = _retTree; - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t158; - _t = _t.getNextSibling(); - break; - } - case LITERAL_if: - { - AST __t160 = _t; - i = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_if); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( i ); print( "(" ); - } - expr(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( ")" ); - } - statement(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_else: - { - e = (TNode)_t; - match(_t,LITERAL_else); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( e ); - } - statement(_t); - _t = _retTree; - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t160; - _t = _t.getNextSibling(); - break; - } - case LITERAL_switch: - { - AST __t162 = _t; - sw = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_switch); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( sw ); print( "(" ); - } - expr(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( ")" ); - } - statement(_t); - _t = _retTree; - _t = __t162; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void binaryExpr(AST _t) throws RecognitionException { - - TNode binaryExpr_AST_in = (TNode)_t; - TNode b = null; - - try { // for error handling - b = _t==ASTNULL ? null : (TNode)_t; - binaryOperator(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - TNode e1, e2; - e1 = (TNode) b.getFirstChild(); - e2 = (TNode) e1.getNextSibling(); - expr( e1 ); - print( b ); - expr( e2 ); - - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void conditionalExpr(AST _t) throws RecognitionException { - - TNode conditionalExpr_AST_in = (TNode)_t; - TNode q = null; - TNode c = null; - - try { // for error handling - AST __t188 = _t; - q = _t==ASTNULL ? null :(TNode)_t; - match(_t,QUESTION); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( q ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - expr(_t); - _t = _retTree; - break; - } - case COLON: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - c = (TNode)_t; - match(_t,COLON); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c ); - } - expr(_t); - _t = _retTree; - _t = __t188; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void castExpr(AST _t) throws RecognitionException { - - TNode castExpr_AST_in = (TNode)_t; - TNode c = null; - TNode rp = null; - - try { // for error handling - AST __t191 = _t; - c = _t==ASTNULL ? null :(TNode)_t; - match(_t,NCast); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( c ); - } - typeName(_t); - _t = _retTree; - rp = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( rp ); - } - expr(_t); - _t = _retTree; - _t = __t191; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void unaryExpr(AST _t) throws RecognitionException { - - TNode unaryExpr_AST_in = (TNode)_t; - TNode i = null; - TNode d = null; - TNode u = null; - TNode s = null; - TNode lps = null; - TNode rps = null; - TNode a = null; - TNode lpa = null; - TNode rpa = null; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case INC: - { - AST __t210 = _t; - i = _t==ASTNULL ? null :(TNode)_t; - match(_t,INC); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( i ); - } - expr(_t); - _t = _retTree; - _t = __t210; - _t = _t.getNextSibling(); - break; - } - case DEC: - { - AST __t211 = _t; - d = _t==ASTNULL ? null :(TNode)_t; - match(_t,DEC); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( d ); - } - expr(_t); - _t = _retTree; - _t = __t211; - _t = _t.getNextSibling(); - break; - } - case NUnaryExpr: - { - AST __t212 = _t; - TNode tmp17_AST_in = (TNode)_t; - match(_t,NUnaryExpr); - _t = _t.getFirstChild(); - u = _t==ASTNULL ? null : (TNode)_t; - unaryOperator(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( u ); - } - expr(_t); - _t = _retTree; - _t = __t212; - _t = _t.getNextSibling(); - break; - } - case LITERAL_sizeof: - { - AST __t213 = _t; - s = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL_sizeof); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( s ); - } - { - boolean synPredMatched216 = false; - if (((_t.getType()==LPAREN))) { - AST __t216 = _t; - synPredMatched216 = true; - inputState.guessing++; - try { - { - TNode tmp18_AST_in = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - typeName(_t); - _t = _retTree; - } - } - catch (RecognitionException pe) { - synPredMatched216 = false; - } - _t = __t216; - inputState.guessing--; - } - if ( synPredMatched216 ) { - lps = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( lps ); - } - typeName(_t); - _t = _retTree; - rps = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( rps ); - } - } - else if ((_tokenSet_3.member(_t.getType()))) { - expr(_t); - _t = _retTree; - } - else { - throw new NoViableAltException(_t); - } - - } - _t = __t213; - _t = _t.getNextSibling(); - break; - } - case LITERAL___alignof: - { - AST __t217 = _t; - a = _t==ASTNULL ? null :(TNode)_t; - match(_t,LITERAL___alignof); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( a ); - } - { - boolean synPredMatched220 = false; - if (((_t.getType()==LPAREN))) { - AST __t220 = _t; - synPredMatched220 = true; - inputState.guessing++; - try { - { - TNode tmp19_AST_in = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - typeName(_t); - _t = _retTree; - } - } - catch (RecognitionException pe) { - synPredMatched220 = false; - } - _t = __t220; - inputState.guessing--; - } - if ( synPredMatched220 ) { - lpa = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( lpa ); - } - typeName(_t); - _t = _retTree; - rpa = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( rpa ); - } - } - else if ((_tokenSet_3.member(_t.getType()))) { - expr(_t); - _t = _retTree; - } - else { - throw new NoViableAltException(_t); - } - - } - _t = __t217; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void postfixExpr(AST _t) throws RecognitionException { - - TNode postfixExpr_AST_in = (TNode)_t; - TNode a = null; - TNode b = null; - TNode c = null; - TNode d = null; - TNode n = null; - TNode rp = null; - TNode lb = null; - TNode rb = null; - TNode f = null; - TNode g = null; - - try { // for error handling - AST __t223 = _t; - TNode tmp20_AST_in = (TNode)_t; - match(_t,NPostfixExpr); - _t = _t.getFirstChild(); - primaryExpr(_t); - _t = _retTree; - { - int _cnt227=0; - _loop227: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case PTR: - { - a = (TNode)_t; - match(_t,PTR); - _t = _t.getNextSibling(); - b = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( a ); print( b ); - } - break; - } - case DOT: - { - c = (TNode)_t; - match(_t,DOT); - _t = _t.getNextSibling(); - d = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c ); print( d ); - } - break; - } - case NFunctionCallArgs: - { - AST __t225 = _t; - n = _t==ASTNULL ? null :(TNode)_t; - match(_t,NFunctionCallArgs); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( n ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - argExprList(_t); - _t = _retTree; - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - rp = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( rp ); - } - _t = __t225; - _t = _t.getNextSibling(); - break; - } - case LBRACKET: - { - lb = (TNode)_t; - match(_t,LBRACKET); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( lb ); - } - expr(_t); - _t = _retTree; - rb = (TNode)_t; - match(_t,RBRACKET); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( rb ); - } - break; - } - case INC: - { - f = (TNode)_t; - match(_t,INC); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( f ); - } - break; - } - case DEC: - { - g = (TNode)_t; - match(_t,DEC); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( g ); - } - break; - } - default: - { - if ( _cnt227>=1 ) { break _loop227; } else {throw new NoViableAltException(_t);} - } - } - _cnt227++; - } while (true); - } - _t = __t223; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void primaryExpr(AST _t) throws RecognitionException { - - TNode primaryExpr_AST_in = (TNode)_t; - TNode i = null; - TNode n = null; - TNode eg = null; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - { - i = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( i ); - } - break; - } - case Number: - { - n = (TNode)_t; - match(_t,Number); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( n ); - } - break; - } - case CharLiteral: - { - charConst(_t); - _t = _retTree; - break; - } - case NStringSeq: - { - stringConst(_t); - _t = _retTree; - break; - } - case NExpressionGroup: - { - AST __t229 = _t; - eg = _t==ASTNULL ? null :(TNode)_t; - match(_t,NExpressionGroup); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( eg ); - } - expr(_t); - _t = _retTree; - if ( inputState.guessing==0 ) { - print( ")" ); - } - _t = __t229; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void emptyExpr(AST _t) throws RecognitionException { - - TNode emptyExpr_AST_in = (TNode)_t; - - try { // for error handling - TNode tmp21_AST_in = (TNode)_t; - match(_t,NEmptyExpression); - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void compoundStatementExpr(AST _t) throws RecognitionException { - - TNode compoundStatementExpr_AST_in = (TNode)_t; - TNode l = null; - TNode r = null; - - try { // for error handling - AST __t166 = _t; - l = _t==ASTNULL ? null :(TNode)_t; - match(_t,LPAREN); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( l ); - } - compoundStatement(_t); - _t = _retTree; - r = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( r ); - } - _t = __t166; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void rangeExpr(AST _t) throws RecognitionException { - - TNode rangeExpr_AST_in = (TNode)_t; - TNode v = null; - - try { // for error handling - AST __t168 = _t; - TNode tmp22_AST_in = (TNode)_t; - match(_t,NRangeExpr); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - v = (TNode)_t; - match(_t,VARARGS); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( v ); - } - expr(_t); - _t = _retTree; - _t = __t168; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void gnuAsmExpr(AST _t) throws RecognitionException { - - TNode gnuAsmExpr_AST_in = (TNode)_t; - TNode n = null; - TNode v = null; - TNode lp = null; - TNode c1 = null; - TNode c2 = null; - TNode c3 = null; - TNode c4 = null; - TNode c5 = null; - TNode c6 = null; - TNode rp = null; - - try { // for error handling - AST __t170 = _t; - n = _t==ASTNULL ? null :(TNode)_t; - match(_t,NGnuAsmExpr); - _t = _t.getFirstChild(); - if ( inputState.guessing==0 ) { - print( n ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_volatile: - { - v = (TNode)_t; - match(_t,LITERAL_volatile); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( v ); - } - break; - } - case LPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - lp = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( lp ); - } - stringConst(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==COLON)) { - c1 = (TNode)_t; - match(_t,COLON); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c1 ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NStringSeq: - { - strOptExprPair(_t); - _t = _retTree; - { - _loop175: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==COMMA)) { - c2 = (TNode)_t; - match(_t,COMMA); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c2 ); - } - strOptExprPair(_t); - _t = _retTree; - } - else { - break _loop175; - } - - } while (true); - } - break; - } - case COLON: - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==COLON)) { - c3 = (TNode)_t; - match(_t,COLON); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c3 ); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NStringSeq: - { - strOptExprPair(_t); - _t = _retTree; - { - _loop179: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==COMMA)) { - c4 = (TNode)_t; - match(_t,COMMA); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c4 ); - } - strOptExprPair(_t); - _t = _retTree; - } - else { - break _loop179; - } - - } while (true); - } - break; - } - case COLON: - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - } - else if ((_t.getType()==COLON||_t.getType()==RPAREN)) { - } - else { - throw new NoViableAltException(_t); - } - - } - } - else if ((_t.getType()==COLON||_t.getType()==RPAREN)) { - } - else { - throw new NoViableAltException(_t); - } - - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case COLON: - { - c5 = (TNode)_t; - match(_t,COLON); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c5 ); - } - stringConst(_t); - _t = _retTree; - { - _loop182: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==COMMA)) { - c6 = (TNode)_t; - match(_t,COMMA); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c6 ); - } - stringConst(_t); - _t = _retTree; - } - else { - break _loop182; - } - - } while (true); - } - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - rp = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( rp ); - } - _t = __t170; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - protected final void stringConst(AST _t) throws RecognitionException { - - TNode stringConst_AST_in = (TNode)_t; - TNode s = null; - - try { // for error handling - AST __t235 = _t; - TNode tmp23_AST_in = (TNode)_t; - match(_t,NStringSeq); - _t = _t.getFirstChild(); - { - int _cnt237=0; - _loop237: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==StringLiteral)) { - s = (TNode)_t; - match(_t,StringLiteral); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( s ); - } - } - else { - if ( _cnt237>=1 ) { break _loop237; } else {throw new NoViableAltException(_t);} - } - - _cnt237++; - } while (true); - } - _t = __t235; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void strOptExprPair(AST _t) throws RecognitionException { - - TNode strOptExprPair_AST_in = (TNode)_t; - TNode l = null; - TNode r = null; - - try { // for error handling - stringConst(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LPAREN: - { - l = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( l ); - } - expr(_t); - _t = _retTree; - r = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( r ); - } - break; - } - case COMMA: - case COLON: - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void binaryOperator(AST _t) throws RecognitionException { - - TNode binaryOperator_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ASSIGN: - { - TNode tmp24_AST_in = (TNode)_t; - match(_t,ASSIGN); - _t = _t.getNextSibling(); - break; - } - case DIV_ASSIGN: - { - TNode tmp25_AST_in = (TNode)_t; - match(_t,DIV_ASSIGN); - _t = _t.getNextSibling(); - break; - } - case PLUS_ASSIGN: - { - TNode tmp26_AST_in = (TNode)_t; - match(_t,PLUS_ASSIGN); - _t = _t.getNextSibling(); - break; - } - case MINUS_ASSIGN: - { - TNode tmp27_AST_in = (TNode)_t; - match(_t,MINUS_ASSIGN); - _t = _t.getNextSibling(); - break; - } - case STAR_ASSIGN: - { - TNode tmp28_AST_in = (TNode)_t; - match(_t,STAR_ASSIGN); - _t = _t.getNextSibling(); - break; - } - case MOD_ASSIGN: - { - TNode tmp29_AST_in = (TNode)_t; - match(_t,MOD_ASSIGN); - _t = _t.getNextSibling(); - break; - } - case RSHIFT_ASSIGN: - { - TNode tmp30_AST_in = (TNode)_t; - match(_t,RSHIFT_ASSIGN); - _t = _t.getNextSibling(); - break; - } - case LSHIFT_ASSIGN: - { - TNode tmp31_AST_in = (TNode)_t; - match(_t,LSHIFT_ASSIGN); - _t = _t.getNextSibling(); - break; - } - case BAND_ASSIGN: - { - TNode tmp32_AST_in = (TNode)_t; - match(_t,BAND_ASSIGN); - _t = _t.getNextSibling(); - break; - } - case BOR_ASSIGN: - { - TNode tmp33_AST_in = (TNode)_t; - match(_t,BOR_ASSIGN); - _t = _t.getNextSibling(); - break; - } - case BXOR_ASSIGN: - { - TNode tmp34_AST_in = (TNode)_t; - match(_t,BXOR_ASSIGN); - _t = _t.getNextSibling(); - break; - } - case LOR: - { - TNode tmp35_AST_in = (TNode)_t; - match(_t,LOR); - _t = _t.getNextSibling(); - break; - } - case LAND: - { - TNode tmp36_AST_in = (TNode)_t; - match(_t,LAND); - _t = _t.getNextSibling(); - break; - } - case BOR: - { - TNode tmp37_AST_in = (TNode)_t; - match(_t,BOR); - _t = _t.getNextSibling(); - break; - } - case BXOR: - { - TNode tmp38_AST_in = (TNode)_t; - match(_t,BXOR); - _t = _t.getNextSibling(); - break; - } - case BAND: - { - TNode tmp39_AST_in = (TNode)_t; - match(_t,BAND); - _t = _t.getNextSibling(); - break; - } - case EQUAL: - { - TNode tmp40_AST_in = (TNode)_t; - match(_t,EQUAL); - _t = _t.getNextSibling(); - break; - } - case NOT_EQUAL: - { - TNode tmp41_AST_in = (TNode)_t; - match(_t,NOT_EQUAL); - _t = _t.getNextSibling(); - break; - } - case LT: - { - TNode tmp42_AST_in = (TNode)_t; - match(_t,LT); - _t = _t.getNextSibling(); - break; - } - case LTE: - { - TNode tmp43_AST_in = (TNode)_t; - match(_t,LTE); - _t = _t.getNextSibling(); - break; - } - case GT: - { - TNode tmp44_AST_in = (TNode)_t; - match(_t,GT); - _t = _t.getNextSibling(); - break; - } - case GTE: - { - TNode tmp45_AST_in = (TNode)_t; - match(_t,GTE); - _t = _t.getNextSibling(); - break; - } - case LSHIFT: - { - TNode tmp46_AST_in = (TNode)_t; - match(_t,LSHIFT); - _t = _t.getNextSibling(); - break; - } - case RSHIFT: - { - TNode tmp47_AST_in = (TNode)_t; - match(_t,RSHIFT); - _t = _t.getNextSibling(); - break; - } - case PLUS: - { - TNode tmp48_AST_in = (TNode)_t; - match(_t,PLUS); - _t = _t.getNextSibling(); - break; - } - case MINUS: - { - TNode tmp49_AST_in = (TNode)_t; - match(_t,MINUS); - _t = _t.getNextSibling(); - break; - } - case STAR: - { - TNode tmp50_AST_in = (TNode)_t; - match(_t,STAR); - _t = _t.getNextSibling(); - break; - } - case DIV: - { - TNode tmp51_AST_in = (TNode)_t; - match(_t,DIV); - _t = _t.getNextSibling(); - break; - } - case MOD: - { - TNode tmp52_AST_in = (TNode)_t; - match(_t,MOD); - _t = _t.getNextSibling(); - break; - } - case NCommaExpr: - { - TNode tmp53_AST_in = (TNode)_t; - match(_t,NCommaExpr); - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void unaryOperator(AST _t) throws RecognitionException { - - TNode unaryOperator_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case BAND: - { - TNode tmp54_AST_in = (TNode)_t; - match(_t,BAND); - _t = _t.getNextSibling(); - break; - } - case STAR: - { - TNode tmp55_AST_in = (TNode)_t; - match(_t,STAR); - _t = _t.getNextSibling(); - break; - } - case PLUS: - { - TNode tmp56_AST_in = (TNode)_t; - match(_t,PLUS); - _t = _t.getNextSibling(); - break; - } - case MINUS: - { - TNode tmp57_AST_in = (TNode)_t; - match(_t,MINUS); - _t = _t.getNextSibling(); - break; - } - case BNOT: - { - TNode tmp58_AST_in = (TNode)_t; - match(_t,BNOT); - _t = _t.getNextSibling(); - break; - } - case LNOT: - { - TNode tmp59_AST_in = (TNode)_t; - match(_t,LNOT); - _t = _t.getNextSibling(); - break; - } - case LAND: - { - TNode tmp60_AST_in = (TNode)_t; - match(_t,LAND); - _t = _t.getNextSibling(); - break; - } - case LITERAL___real: - { - TNode tmp61_AST_in = (TNode)_t; - match(_t,LITERAL___real); - _t = _t.getNextSibling(); - break; - } - case LITERAL___imag: - { - TNode tmp62_AST_in = (TNode)_t; - match(_t,LITERAL___imag); - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void argExprList(AST _t) throws RecognitionException { - - TNode argExprList_AST_in = (TNode)_t; - - try { // for error handling - expr(_t); - _t = _retTree; - { - _loop232: - do { - if (_t==null) _t=ASTNULL; - if ((_tokenSet_3.member(_t.getType()))) { - if ( inputState.guessing==0 ) { - print( "," ); - } - expr(_t); - _t = _retTree; - } - else { - break _loop232; - } - - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - protected final void charConst(AST _t) throws RecognitionException { - - TNode charConst_AST_in = (TNode)_t; - TNode c = null; - - try { // for error handling - c = (TNode)_t; - match(_t,CharLiteral); - _t = _t.getNextSibling(); - if ( inputState.guessing==0 ) { - print( c ); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - protected final void intConst(AST _t) throws RecognitionException { - - TNode intConst_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case IntOctalConst: - { - TNode tmp63_AST_in = (TNode)_t; - match(_t,IntOctalConst); - _t = _t.getNextSibling(); - break; - } - case LongOctalConst: - { - TNode tmp64_AST_in = (TNode)_t; - match(_t,LongOctalConst); - _t = _t.getNextSibling(); - break; - } - case UnsignedOctalConst: - { - TNode tmp65_AST_in = (TNode)_t; - match(_t,UnsignedOctalConst); - _t = _t.getNextSibling(); - break; - } - case IntIntConst: - { - TNode tmp66_AST_in = (TNode)_t; - match(_t,IntIntConst); - _t = _t.getNextSibling(); - break; - } - case LongIntConst: - { - TNode tmp67_AST_in = (TNode)_t; - match(_t,LongIntConst); - _t = _t.getNextSibling(); - break; - } - case UnsignedIntConst: - { - TNode tmp68_AST_in = (TNode)_t; - match(_t,UnsignedIntConst); - _t = _t.getNextSibling(); - break; - } - case IntHexConst: - { - TNode tmp69_AST_in = (TNode)_t; - match(_t,IntHexConst); - _t = _t.getNextSibling(); - break; - } - case LongHexConst: - { - TNode tmp70_AST_in = (TNode)_t; - match(_t,LongHexConst); - _t = _t.getNextSibling(); - break; - } - case UnsignedHexConst: - { - TNode tmp71_AST_in = (TNode)_t; - match(_t,UnsignedHexConst); - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - protected final void floatConst(AST _t) throws RecognitionException { - - TNode floatConst_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case FloatDoubleConst: - { - TNode tmp72_AST_in = (TNode)_t; - match(_t,FloatDoubleConst); - _t = _t.getNextSibling(); - break; - } - case DoubleDoubleConst: - { - TNode tmp73_AST_in = (TNode)_t; - match(_t,DoubleDoubleConst); - _t = _t.getNextSibling(); - break; - } - case LongDoubleConst: - { - TNode tmp74_AST_in = (TNode)_t; - match(_t,LongDoubleConst); - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void commaExpr(AST _t) throws RecognitionException { - - TNode commaExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t241 = _t; - TNode tmp75_AST_in = (TNode)_t; - match(_t,NCommaExpr); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t241; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void assignExpr(AST _t) throws RecognitionException { - - TNode assignExpr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ASSIGN: - { - AST __t243 = _t; - TNode tmp76_AST_in = (TNode)_t; - match(_t,ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t243; - _t = _t.getNextSibling(); - break; - } - case DIV_ASSIGN: - { - AST __t244 = _t; - TNode tmp77_AST_in = (TNode)_t; - match(_t,DIV_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t244; - _t = _t.getNextSibling(); - break; - } - case PLUS_ASSIGN: - { - AST __t245 = _t; - TNode tmp78_AST_in = (TNode)_t; - match(_t,PLUS_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t245; - _t = _t.getNextSibling(); - break; - } - case MINUS_ASSIGN: - { - AST __t246 = _t; - TNode tmp79_AST_in = (TNode)_t; - match(_t,MINUS_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t246; - _t = _t.getNextSibling(); - break; - } - case STAR_ASSIGN: - { - AST __t247 = _t; - TNode tmp80_AST_in = (TNode)_t; - match(_t,STAR_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t247; - _t = _t.getNextSibling(); - break; - } - case MOD_ASSIGN: - { - AST __t248 = _t; - TNode tmp81_AST_in = (TNode)_t; - match(_t,MOD_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t248; - _t = _t.getNextSibling(); - break; - } - case RSHIFT_ASSIGN: - { - AST __t249 = _t; - TNode tmp82_AST_in = (TNode)_t; - match(_t,RSHIFT_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t249; - _t = _t.getNextSibling(); - break; - } - case LSHIFT_ASSIGN: - { - AST __t250 = _t; - TNode tmp83_AST_in = (TNode)_t; - match(_t,LSHIFT_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t250; - _t = _t.getNextSibling(); - break; - } - case BAND_ASSIGN: - { - AST __t251 = _t; - TNode tmp84_AST_in = (TNode)_t; - match(_t,BAND_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t251; - _t = _t.getNextSibling(); - break; - } - case BOR_ASSIGN: - { - AST __t252 = _t; - TNode tmp85_AST_in = (TNode)_t; - match(_t,BOR_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t252; - _t = _t.getNextSibling(); - break; - } - case BXOR_ASSIGN: - { - AST __t253 = _t; - TNode tmp86_AST_in = (TNode)_t; - match(_t,BXOR_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t253; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void logicalOrExpr(AST _t) throws RecognitionException { - - TNode logicalOrExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t255 = _t; - TNode tmp87_AST_in = (TNode)_t; - match(_t,LOR); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t255; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void logicalAndExpr(AST _t) throws RecognitionException { - - TNode logicalAndExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t257 = _t; - TNode tmp88_AST_in = (TNode)_t; - match(_t,LAND); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t257; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void inclusiveOrExpr(AST _t) throws RecognitionException { - - TNode inclusiveOrExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t259 = _t; - TNode tmp89_AST_in = (TNode)_t; - match(_t,BOR); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t259; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void exclusiveOrExpr(AST _t) throws RecognitionException { - - TNode exclusiveOrExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t261 = _t; - TNode tmp90_AST_in = (TNode)_t; - match(_t,BXOR); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t261; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void bitAndExpr(AST _t) throws RecognitionException { - - TNode bitAndExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t263 = _t; - TNode tmp91_AST_in = (TNode)_t; - match(_t,BAND); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t263; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void equalityExpr(AST _t) throws RecognitionException { - - TNode equalityExpr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case EQUAL: - { - AST __t265 = _t; - TNode tmp92_AST_in = (TNode)_t; - match(_t,EQUAL); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t265; - _t = _t.getNextSibling(); - break; - } - case NOT_EQUAL: - { - AST __t266 = _t; - TNode tmp93_AST_in = (TNode)_t; - match(_t,NOT_EQUAL); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t266; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void relationalExpr(AST _t) throws RecognitionException { - - TNode relationalExpr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LT: - { - AST __t268 = _t; - TNode tmp94_AST_in = (TNode)_t; - match(_t,LT); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t268; - _t = _t.getNextSibling(); - break; - } - case LTE: - { - AST __t269 = _t; - TNode tmp95_AST_in = (TNode)_t; - match(_t,LTE); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t269; - _t = _t.getNextSibling(); - break; - } - case GT: - { - AST __t270 = _t; - TNode tmp96_AST_in = (TNode)_t; - match(_t,GT); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t270; - _t = _t.getNextSibling(); - break; - } - case GTE: - { - AST __t271 = _t; - TNode tmp97_AST_in = (TNode)_t; - match(_t,GTE); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t271; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void shiftExpr(AST _t) throws RecognitionException { - - TNode shiftExpr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LSHIFT: - { - AST __t273 = _t; - TNode tmp98_AST_in = (TNode)_t; - match(_t,LSHIFT); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t273; - _t = _t.getNextSibling(); - break; - } - case RSHIFT: - { - AST __t274 = _t; - TNode tmp99_AST_in = (TNode)_t; - match(_t,RSHIFT); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t274; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void additiveExpr(AST _t) throws RecognitionException { - - TNode additiveExpr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case PLUS: - { - AST __t276 = _t; - TNode tmp100_AST_in = (TNode)_t; - match(_t,PLUS); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t276; - _t = _t.getNextSibling(); - break; - } - case MINUS: - { - AST __t277 = _t; - TNode tmp101_AST_in = (TNode)_t; - match(_t,MINUS); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t277; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void multExpr(AST _t) throws RecognitionException { - - TNode multExpr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case STAR: - { - AST __t279 = _t; - TNode tmp102_AST_in = (TNode)_t; - match(_t,STAR); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t279; - _t = _t.getNextSibling(); - break; - } - case DIV: - { - AST __t280 = _t; - TNode tmp103_AST_in = (TNode)_t; - match(_t,DIV); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t280; - _t = _t.getNextSibling(); - break; - } - case MOD: - { - AST __t281 = _t; - TNode tmp104_AST_in = (TNode)_t; - match(_t,MOD); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t281; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - - public static final String[] _tokenNames = { - "<0>", - "EOF", - "<2>", - "NULL_TREE_LOOKAHEAD", - "\"typedef\"", - "\"asm\"", - "\"volatile\"", - "LCURLY", - "RCURLY", - "SEMI", - "\"struct\"", - "\"union\"", - "\"enum\"", - "\"auto\"", - "\"register\"", - "\"extern\"", - "\"static\"", - "\"const\"", - "\"void\"", - "\"char\"", - "\"short\"", - "\"int\"", - "\"long\"", - "\"float\"", - "\"double\"", - "\"signed\"", - "\"unsigned\"", - "ID", - "COMMA", - "COLON", - "ASSIGN", - "STAR", - "LPAREN", - "RPAREN", - "LBRACKET", - "RBRACKET", - "VARARGS", - "\"while\"", - "\"do\"", - "\"for\"", - "\"goto\"", - "\"continue\"", - "\"break\"", - "\"return\"", - "\"case\"", - "\"default\"", - "\"if\"", - "\"else\"", - "\"switch\"", - "DIV_ASSIGN", - "PLUS_ASSIGN", - "MINUS_ASSIGN", - "STAR_ASSIGN", - "MOD_ASSIGN", - "RSHIFT_ASSIGN", - "LSHIFT_ASSIGN", - "BAND_ASSIGN", - "BOR_ASSIGN", - "BXOR_ASSIGN", - "QUESTION", - "LOR", - "LAND", - "BOR", - "BXOR", - "BAND", - "EQUAL", - "NOT_EQUAL", - "LT", - "LTE", - "GT", - "GTE", - "LSHIFT", - "RSHIFT", - "PLUS", - "MINUS", - "DIV", - "MOD", - "INC", - "DEC", - "\"sizeof\"", - "BNOT", - "LNOT", - "PTR", - "DOT", - "CharLiteral", - "StringLiteral", - "IntOctalConst", - "LongOctalConst", - "UnsignedOctalConst", - "IntIntConst", - "LongIntConst", - "UnsignedIntConst", - "IntHexConst", - "LongHexConst", - "UnsignedHexConst", - "FloatDoubleConst", - "DoubleDoubleConst", - "LongDoubleConst", - "NTypedefName", - "NInitDecl", - "NDeclarator", - "NStructDeclarator", - "NDeclaration", - "NCast", - "NPointerGroup", - "NExpressionGroup", - "NFunctionCallArgs", - "NNonemptyAbstractDeclarator", - "NInitializer", - "NStatementExpr", - "NEmptyExpression", - "NParameterTypeList", - "NFunctionDef", - "NCompoundStatement", - "NParameterDeclaration", - "NCommaExpr", - "NUnaryExpr", - "NLabel", - "NPostfixExpr", - "NRangeExpr", - "NStringSeq", - "NInitializerElementLabel", - "NLcurlyInitializer", - "NAsmAttribute", - "NGnuAsmExpr", - "NTypeMissing", - "Vocabulary", - "Whitespace", - "Comment", - "CPPComment", - "a line directive", - "Space", - "LineDirective", - "BadStringLiteral", - "Escape", - "Digit", - "LongSuffix", - "UnsignedSuffix", - "FloatSuffix", - "Exponent", - "Number", - "\"__label__\"", - "\"inline\"", - "\"byte\"", - "\"boolean\"", - "\"Servo\"", - "\"Wire\"", - "\"typeof\"", - "\"__complex\"", - "\"__attribute\"", - "\"__alignof\"", - "\"__real\"", - "\"__imag\"" - }; - - private static final long[] mk_tokenSet_0() { - long[] data = { 544L, 2306124759068311552L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); - private static final long[] mk_tokenSet_1() { - long[] data = { 134093888L, 17179869184L, 2064384L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); - private static final long[] mk_tokenSet_2() { - long[] data = { 422075026113024L, 9605333580251136L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); - private static final long[] mk_tokenSet_3() { - long[] data = { -562942303010816L, 1574098779476393983L, 4198400L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3()); - } - diff --git a/app/preproc/WEmitterTokenTypes.java b/app/preproc/WEmitterTokenTypes.java deleted file mode 100644 index 7ecef70d5..000000000 --- a/app/preproc/WEmitterTokenTypes.java +++ /dev/null @@ -1,163 +0,0 @@ -// $ANTLR 2.7.2: "expandedWEmitter.g" -> "WEmitter.java"$ - -package processing.app.preproc; -import processing.app.*; -import java.io.*; -import java.util.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; - -public interface WEmitterTokenTypes { - int EOF = 1; - int NULL_TREE_LOOKAHEAD = 3; - int LITERAL_typedef = 4; - int LITERAL_asm = 5; - int LITERAL_volatile = 6; - int LCURLY = 7; - int RCURLY = 8; - int SEMI = 9; - int LITERAL_struct = 10; - int LITERAL_union = 11; - int LITERAL_enum = 12; - int LITERAL_auto = 13; - int LITERAL_register = 14; - int LITERAL_extern = 15; - int LITERAL_static = 16; - int LITERAL_const = 17; - int LITERAL_void = 18; - int LITERAL_char = 19; - int LITERAL_short = 20; - int LITERAL_int = 21; - int LITERAL_long = 22; - int LITERAL_float = 23; - int LITERAL_double = 24; - int LITERAL_signed = 25; - int LITERAL_unsigned = 26; - int ID = 27; - int COMMA = 28; - int COLON = 29; - int ASSIGN = 30; - int STAR = 31; - int LPAREN = 32; - int RPAREN = 33; - int LBRACKET = 34; - int RBRACKET = 35; - int VARARGS = 36; - int LITERAL_while = 37; - int LITERAL_do = 38; - int LITERAL_for = 39; - int LITERAL_goto = 40; - int LITERAL_continue = 41; - int LITERAL_break = 42; - int LITERAL_return = 43; - int LITERAL_case = 44; - int LITERAL_default = 45; - int LITERAL_if = 46; - int LITERAL_else = 47; - int LITERAL_switch = 48; - int DIV_ASSIGN = 49; - int PLUS_ASSIGN = 50; - int MINUS_ASSIGN = 51; - int STAR_ASSIGN = 52; - int MOD_ASSIGN = 53; - int RSHIFT_ASSIGN = 54; - int LSHIFT_ASSIGN = 55; - int BAND_ASSIGN = 56; - int BOR_ASSIGN = 57; - int BXOR_ASSIGN = 58; - int QUESTION = 59; - int LOR = 60; - int LAND = 61; - int BOR = 62; - int BXOR = 63; - int BAND = 64; - int EQUAL = 65; - int NOT_EQUAL = 66; - int LT = 67; - int LTE = 68; - int GT = 69; - int GTE = 70; - int LSHIFT = 71; - int RSHIFT = 72; - int PLUS = 73; - int MINUS = 74; - int DIV = 75; - int MOD = 76; - int INC = 77; - int DEC = 78; - int LITERAL_sizeof = 79; - int BNOT = 80; - int LNOT = 81; - int PTR = 82; - int DOT = 83; - int CharLiteral = 84; - int StringLiteral = 85; - int IntOctalConst = 86; - int LongOctalConst = 87; - int UnsignedOctalConst = 88; - int IntIntConst = 89; - int LongIntConst = 90; - int UnsignedIntConst = 91; - int IntHexConst = 92; - int LongHexConst = 93; - int UnsignedHexConst = 94; - int FloatDoubleConst = 95; - int DoubleDoubleConst = 96; - int LongDoubleConst = 97; - int NTypedefName = 98; - int NInitDecl = 99; - int NDeclarator = 100; - int NStructDeclarator = 101; - int NDeclaration = 102; - int NCast = 103; - int NPointerGroup = 104; - int NExpressionGroup = 105; - int NFunctionCallArgs = 106; - int NNonemptyAbstractDeclarator = 107; - int NInitializer = 108; - int NStatementExpr = 109; - int NEmptyExpression = 110; - int NParameterTypeList = 111; - int NFunctionDef = 112; - int NCompoundStatement = 113; - int NParameterDeclaration = 114; - int NCommaExpr = 115; - int NUnaryExpr = 116; - int NLabel = 117; - int NPostfixExpr = 118; - int NRangeExpr = 119; - int NStringSeq = 120; - int NInitializerElementLabel = 121; - int NLcurlyInitializer = 122; - int NAsmAttribute = 123; - int NGnuAsmExpr = 124; - int NTypeMissing = 125; - int Vocabulary = 126; - int Whitespace = 127; - int Comment = 128; - int CPPComment = 129; - int PREPROC_DIRECTIVE = 130; - int Space = 131; - int LineDirective = 132; - int BadStringLiteral = 133; - int Escape = 134; - int Digit = 135; - int LongSuffix = 136; - int UnsignedSuffix = 137; - int FloatSuffix = 138; - int Exponent = 139; - int Number = 140; - int LITERAL___label__ = 141; - int LITERAL_inline = 142; - int LITERAL_byte = 143; - int LITERAL_boolean = 144; - int LITERAL_Servo = 145; - int LITERAL_Wire = 146; - int LITERAL_typeof = 147; - int LITERAL___complex = 148; - int LITERAL___attribute = 149; - int LITERAL___alignof = 150; - int LITERAL___real = 151; - int LITERAL___imag = 152; -} diff --git a/app/preproc/WEmitterTokenTypes.txt b/app/preproc/WEmitterTokenTypes.txt deleted file mode 100644 index f192158c5..000000000 --- a/app/preproc/WEmitterTokenTypes.txt +++ /dev/null @@ -1,151 +0,0 @@ -// $ANTLR 2.7.2: expandedWEmitter.g -> WEmitterTokenTypes.txt$ -WEmitter // output token vocab name -LITERAL_typedef="typedef"=4 -LITERAL_asm="asm"=5 -LITERAL_volatile="volatile"=6 -LCURLY=7 -RCURLY=8 -SEMI=9 -LITERAL_struct="struct"=10 -LITERAL_union="union"=11 -LITERAL_enum="enum"=12 -LITERAL_auto="auto"=13 -LITERAL_register="register"=14 -LITERAL_extern="extern"=15 -LITERAL_static="static"=16 -LITERAL_const="const"=17 -LITERAL_void="void"=18 -LITERAL_char="char"=19 -LITERAL_short="short"=20 -LITERAL_int="int"=21 -LITERAL_long="long"=22 -LITERAL_float="float"=23 -LITERAL_double="double"=24 -LITERAL_signed="signed"=25 -LITERAL_unsigned="unsigned"=26 -ID=27 -COMMA=28 -COLON=29 -ASSIGN=30 -STAR=31 -LPAREN=32 -RPAREN=33 -LBRACKET=34 -RBRACKET=35 -VARARGS=36 -LITERAL_while="while"=37 -LITERAL_do="do"=38 -LITERAL_for="for"=39 -LITERAL_goto="goto"=40 -LITERAL_continue="continue"=41 -LITERAL_break="break"=42 -LITERAL_return="return"=43 -LITERAL_case="case"=44 -LITERAL_default="default"=45 -LITERAL_if="if"=46 -LITERAL_else="else"=47 -LITERAL_switch="switch"=48 -DIV_ASSIGN=49 -PLUS_ASSIGN=50 -MINUS_ASSIGN=51 -STAR_ASSIGN=52 -MOD_ASSIGN=53 -RSHIFT_ASSIGN=54 -LSHIFT_ASSIGN=55 -BAND_ASSIGN=56 -BOR_ASSIGN=57 -BXOR_ASSIGN=58 -QUESTION=59 -LOR=60 -LAND=61 -BOR=62 -BXOR=63 -BAND=64 -EQUAL=65 -NOT_EQUAL=66 -LT=67 -LTE=68 -GT=69 -GTE=70 -LSHIFT=71 -RSHIFT=72 -PLUS=73 -MINUS=74 -DIV=75 -MOD=76 -INC=77 -DEC=78 -LITERAL_sizeof="sizeof"=79 -BNOT=80 -LNOT=81 -PTR=82 -DOT=83 -CharLiteral=84 -StringLiteral=85 -IntOctalConst=86 -LongOctalConst=87 -UnsignedOctalConst=88 -IntIntConst=89 -LongIntConst=90 -UnsignedIntConst=91 -IntHexConst=92 -LongHexConst=93 -UnsignedHexConst=94 -FloatDoubleConst=95 -DoubleDoubleConst=96 -LongDoubleConst=97 -NTypedefName=98 -NInitDecl=99 -NDeclarator=100 -NStructDeclarator=101 -NDeclaration=102 -NCast=103 -NPointerGroup=104 -NExpressionGroup=105 -NFunctionCallArgs=106 -NNonemptyAbstractDeclarator=107 -NInitializer=108 -NStatementExpr=109 -NEmptyExpression=110 -NParameterTypeList=111 -NFunctionDef=112 -NCompoundStatement=113 -NParameterDeclaration=114 -NCommaExpr=115 -NUnaryExpr=116 -NLabel=117 -NPostfixExpr=118 -NRangeExpr=119 -NStringSeq=120 -NInitializerElementLabel=121 -NLcurlyInitializer=122 -NAsmAttribute=123 -NGnuAsmExpr=124 -NTypeMissing=125 -Vocabulary=126 -Whitespace=127 -Comment=128 -CPPComment=129 -PREPROC_DIRECTIVE("a line directive")=130 -Space=131 -LineDirective=132 -BadStringLiteral=133 -Escape=134 -Digit=135 -LongSuffix=136 -UnsignedSuffix=137 -FloatSuffix=138 -Exponent=139 -Number=140 -LITERAL___label__="__label__"=141 -LITERAL_inline="inline"=142 -LITERAL_byte="byte"=143 -LITERAL_boolean="boolean"=144 -LITERAL_Servo="Servo"=145 -LITERAL_Wire="Wire"=146 -LITERAL_typeof="typeof"=147 -LITERAL___complex="__complex"=148 -LITERAL___attribute="__attribute"=149 -LITERAL___alignof="__alignof"=150 -LITERAL___real="__real"=151 -LITERAL___imag="__imag"=152 diff --git a/app/preproc/WLexer.java b/app/preproc/WLexer.java deleted file mode 100644 index 546512075..000000000 --- a/app/preproc/WLexer.java +++ /dev/null @@ -1,2810 +0,0 @@ -// $ANTLR 2.7.2: "expandedWParser.g" -> "WLexer.java"$ - -package processing.app.preproc; - -import java.io.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; - -import java.io.InputStream; -import antlr.TokenStreamException; -import antlr.TokenStreamIOException; -import antlr.TokenStreamRecognitionException; -import antlr.CharStreamException; -import antlr.CharStreamIOException; -import antlr.ANTLRException; -import java.io.Reader; -import java.util.Hashtable; -import antlr.CharScanner; -import antlr.InputBuffer; -import antlr.ByteBuffer; -import antlr.CharBuffer; -import antlr.Token; -import antlr.CommonToken; -import antlr.RecognitionException; -import antlr.NoViableAltForCharException; -import antlr.MismatchedCharException; -import antlr.TokenStream; -import antlr.ANTLRHashString; -import antlr.LexerSharedInputState; -import antlr.collections.impl.BitSet; -import antlr.SemanticException; - -// import CToken; - import java.io.*; -// import LineObject; - import antlr.*; - -public class WLexer extends antlr.CharScanner implements WLexerTokenTypes, TokenStream - { - - public void initialize(String src) - { - setOriginalSource(src); - initialize(); - } - - public void initialize() - { - literals.put(new ANTLRHashString("__alignof__", this), new Integer(LITERAL___alignof)); - literals.put(new ANTLRHashString("__asm", this), new Integer(LITERAL_asm)); - literals.put(new ANTLRHashString("__asm__", this), new Integer(LITERAL_asm)); - literals.put(new ANTLRHashString("__attribute__", this), new Integer(LITERAL___attribute)); - literals.put(new ANTLRHashString("__complex__", this), new Integer(LITERAL___complex)); - literals.put(new ANTLRHashString("__const", this), new Integer(LITERAL_const)); - literals.put(new ANTLRHashString("__const__", this), new Integer(LITERAL_const)); - literals.put(new ANTLRHashString("__imag__", this), new Integer(LITERAL___imag)); - literals.put(new ANTLRHashString("__inline", this), new Integer(LITERAL_inline)); - literals.put(new ANTLRHashString("__inline__", this), new Integer(LITERAL_inline)); - literals.put(new ANTLRHashString("__real__", this), new Integer(LITERAL___real)); - literals.put(new ANTLRHashString("__signed", this), new Integer(LITERAL_signed)); - literals.put(new ANTLRHashString("__signed__", this), new Integer(LITERAL_signed)); - literals.put(new ANTLRHashString("__typeof", this), new Integer(LITERAL_typeof)); - literals.put(new ANTLRHashString("__typeof__", this), new Integer(LITERAL_typeof)); - literals.put(new ANTLRHashString("__volatile", this), new Integer(LITERAL_volatile)); - literals.put(new ANTLRHashString("__volatile__", this), new Integer(LITERAL_volatile)); - } - - - LineObject lineObject = new LineObject(); - String originalSource = ""; - PreprocessorInfoChannel preprocessorInfoChannel = new PreprocessorInfoChannel(); - int tokenNumber = 0; - boolean countingTokens = true; - int deferredLineCount = 0; - - public void setCountingTokens(boolean ct) - { - countingTokens = ct; - if ( countingTokens ) { - tokenNumber = 0; - } - else { - tokenNumber = 1; - } - } - - public void setOriginalSource(String src) - { - originalSource = src; - lineObject.setSource(src); - } - public void setSource(String src) - { - lineObject.setSource(src); - } - - public PreprocessorInfoChannel getPreprocessorInfoChannel() - { - return preprocessorInfoChannel; - } - - public void setPreprocessingDirective(String pre) - { - preprocessorInfoChannel.addLineForTokenNumber( pre, new Integer(tokenNumber) ); - } - - protected Token makeToken(int t) - { - if ( t != Token.SKIP && countingTokens) { - tokenNumber++; - } - CToken tok = (CToken) super.makeToken(t); - tok.setLine(lineObject.line); - tok.setSource(lineObject.source); - tok.setTokenNumber(tokenNumber); - - lineObject.line += deferredLineCount; - deferredLineCount = 0; - return tok; - } - - public void deferredNewline() { - deferredLineCount++; - } - - public void newline() { - lineObject.newline(); - } - - - - - - -public WLexer(InputStream in) { - this(new ByteBuffer(in)); -} -public WLexer(Reader in) { - this(new CharBuffer(in)); -} -public WLexer(InputBuffer ib) { - this(new LexerSharedInputState(ib)); -} -public WLexer(LexerSharedInputState state) { - super(state); - caseSensitiveLiterals = true; - setCaseSensitive(true); - literals = new Hashtable(); - literals.put(new ANTLRHashString("byte", this), new Integer(143)); - literals.put(new ANTLRHashString("extern", this), new Integer(15)); - literals.put(new ANTLRHashString("__real", this), new Integer(151)); - literals.put(new ANTLRHashString("case", this), new Integer(44)); - literals.put(new ANTLRHashString("short", this), new Integer(20)); - literals.put(new ANTLRHashString("break", this), new Integer(42)); - literals.put(new ANTLRHashString("while", this), new Integer(37)); - literals.put(new ANTLRHashString("typeof", this), new Integer(147)); - literals.put(new ANTLRHashString("inline", this), new Integer(142)); - literals.put(new ANTLRHashString("unsigned", this), new Integer(26)); - literals.put(new ANTLRHashString("const", this), new Integer(17)); - literals.put(new ANTLRHashString("float", this), new Integer(23)); - literals.put(new ANTLRHashString("return", this), new Integer(43)); - literals.put(new ANTLRHashString("sizeof", this), new Integer(79)); - literals.put(new ANTLRHashString("do", this), new Integer(38)); - literals.put(new ANTLRHashString("__label__", this), new Integer(141)); - literals.put(new ANTLRHashString("typedef", this), new Integer(4)); - literals.put(new ANTLRHashString("if", this), new Integer(46)); - literals.put(new ANTLRHashString("double", this), new Integer(24)); - literals.put(new ANTLRHashString("volatile", this), new Integer(6)); - literals.put(new ANTLRHashString("__attribute", this), new Integer(149)); - literals.put(new ANTLRHashString("union", this), new Integer(11)); - literals.put(new ANTLRHashString("register", this), new Integer(14)); - literals.put(new ANTLRHashString("auto", this), new Integer(13)); - literals.put(new ANTLRHashString("goto", this), new Integer(40)); - literals.put(new ANTLRHashString("enum", this), new Integer(12)); - literals.put(new ANTLRHashString("Servo", this), new Integer(145)); - literals.put(new ANTLRHashString("int", this), new Integer(21)); - literals.put(new ANTLRHashString("for", this), new Integer(39)); - literals.put(new ANTLRHashString("boolean", this), new Integer(144)); - literals.put(new ANTLRHashString("Wire", this), new Integer(146)); - literals.put(new ANTLRHashString("char", this), new Integer(19)); - literals.put(new ANTLRHashString("default", this), new Integer(45)); - literals.put(new ANTLRHashString("__imag", this), new Integer(152)); - literals.put(new ANTLRHashString("__alignof", this), new Integer(150)); - literals.put(new ANTLRHashString("static", this), new Integer(16)); - literals.put(new ANTLRHashString("continue", this), new Integer(41)); - literals.put(new ANTLRHashString("struct", this), new Integer(10)); - literals.put(new ANTLRHashString("signed", this), new Integer(25)); - literals.put(new ANTLRHashString("else", this), new Integer(47)); - literals.put(new ANTLRHashString("void", this), new Integer(18)); - literals.put(new ANTLRHashString("switch", this), new Integer(48)); - literals.put(new ANTLRHashString("long", this), new Integer(22)); - literals.put(new ANTLRHashString("__extension__", this), new Integer(153)); - literals.put(new ANTLRHashString("asm", this), new Integer(5)); - literals.put(new ANTLRHashString("__complex", this), new Integer(148)); -} - -public Token nextToken() throws TokenStreamException { - Token theRetToken=null; -tryAgain: - for (;;) { - Token _token = null; - int _ttype = Token.INVALID_TYPE; - resetText(); - try { // for char stream error handling - try { // for lexical error handling - switch ( LA(1)) { - case '\t': case '\n': case '\u000c': case '\r': - case ' ': - { - mWhitespace(true); - theRetToken=_returnToken; - break; - } - case '.': case '0': case '1': case '2': - case '3': case '4': case '5': case '6': - case '7': case '8': case '9': - { - mNumber(true); - theRetToken=_returnToken; - break; - } - case '\'': - { - mCharLiteral(true); - theRetToken=_returnToken; - break; - } - case '"': - { - mStringLiteral(true); - theRetToken=_returnToken; - break; - } - case ':': - { - mCOLON(true); - theRetToken=_returnToken; - break; - } - case ',': - { - mCOMMA(true); - theRetToken=_returnToken; - break; - } - case '?': - { - mQUESTION(true); - theRetToken=_returnToken; - break; - } - case ';': - { - mSEMI(true); - theRetToken=_returnToken; - break; - } - case '(': - { - mLPAREN(true); - theRetToken=_returnToken; - break; - } - case ')': - { - mRPAREN(true); - theRetToken=_returnToken; - break; - } - case '[': - { - mLBRACKET(true); - theRetToken=_returnToken; - break; - } - case ']': - { - mRBRACKET(true); - theRetToken=_returnToken; - break; - } - case '{': - { - mLCURLY(true); - theRetToken=_returnToken; - break; - } - case '}': - { - mRCURLY(true); - theRetToken=_returnToken; - break; - } - case '~': - { - mBNOT(true); - theRetToken=_returnToken; - break; - } - case '#': - { - mPREPROC_DIRECTIVE(true); - theRetToken=_returnToken; - break; - } - default: - if ((LA(1)=='>') && (LA(2)=='>') && (LA(3)=='=')) { - mRSHIFT_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='<') && (LA(2)=='<') && (LA(3)=='=')) { - mLSHIFT_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='L') && (LA(2)=='\'')) { - mWideCharLiteral(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='L') && (LA(2)=='"')) { - mWideStringLiteral(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='-') && (LA(2)=='>')) { - mPTR(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='=') && (LA(2)=='=')) { - mEQUAL(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='!') && (LA(2)=='=')) { - mNOT_EQUAL(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='<') && (LA(2)=='=')) { - mLTE(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='>') && (LA(2)=='=')) { - mGTE(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='/') && (LA(2)=='=')) { - mDIV_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='+') && (LA(2)=='=')) { - mPLUS_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='+') && (LA(2)=='+')) { - mINC(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='-') && (LA(2)=='=')) { - mMINUS_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='-') && (LA(2)=='-')) { - mDEC(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='*') && (LA(2)=='=')) { - mSTAR_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='%') && (LA(2)=='=')) { - mMOD_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='>') && (LA(2)=='>') && (true)) { - mRSHIFT(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='<') && (LA(2)=='<') && (true)) { - mLSHIFT(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='&') && (LA(2)=='&')) { - mLAND(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='|') && (LA(2)=='|')) { - mLOR(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='&') && (LA(2)=='=')) { - mBAND_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='|') && (LA(2)=='=')) { - mBOR_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='^') && (LA(2)=='=')) { - mBXOR_ASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='/') && (LA(2)=='*')) { - mComment(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='/') && (LA(2)=='/')) { - mCPPComment(true); - theRetToken=_returnToken; - } - else if ((_tokenSet_0.member(LA(1))) && (true)) { - mIDMEAT(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='=') && (true)) { - mASSIGN(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='<') && (true)) { - mLT(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='>') && (true)) { - mGT(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='/') && (true)) { - mDIV(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='+') && (true)) { - mPLUS(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='-') && (true)) { - mMINUS(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='*') && (true)) { - mSTAR(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='%') && (true)) { - mMOD(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='!') && (true)) { - mLNOT(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='&') && (true)) { - mBAND(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='|') && (true)) { - mBOR(true); - theRetToken=_returnToken; - } - else if ((LA(1)=='^') && (true)) { - mBXOR(true); - theRetToken=_returnToken; - } - else { - if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);} - else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - } - if ( _returnToken==null ) continue tryAgain; // found SKIP token - _ttype = _returnToken.getType(); - _returnToken.setType(_ttype); - return _returnToken; - } - catch (RecognitionException e) { - throw new TokenStreamRecognitionException(e); - } - } - catch (CharStreamException cse) { - if ( cse instanceof CharStreamIOException ) { - throw new TokenStreamIOException(((CharStreamIOException)cse).io); - } - else { - throw new TokenStreamException(cse.getMessage()); - } - } - } -} - - public final void mWhitespace(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Whitespace; - int _saveIndex; - - { - if ((LA(1)=='\r') && (LA(2)=='\n')) { - match("\r\n"); - if ( inputState.guessing==0 ) { - newline(); - } - } - else if ((LA(1)=='\t'||LA(1)=='\u000c'||LA(1)==' ')) { - { - switch ( LA(1)) { - case ' ': - { - match(' '); - break; - } - case '\t': - { - match('\t'); - break; - } - case '\u000c': - { - match('\014'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - } - else if ((LA(1)=='\n'||LA(1)=='\r') && (true)) { - { - switch ( LA(1)) { - case '\n': - { - match('\n'); - break; - } - case '\r': - { - match('\r'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - if ( inputState.guessing==0 ) { - newline(); - } - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - if ( inputState.guessing==0 ) { - _ttype = Token.SKIP; - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mEscape(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Escape; - int _saveIndex; - - match('\\'); - { - switch ( LA(1)) { - case '0': case '1': case '2': case '3': - { - { - matchRange('0','3'); - } - { - _loop327: - do { - if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mDigit(false); - } - else { - break _loop327; - } - - } while (true); - } - break; - } - case '4': case '5': case '6': case '7': - { - { - matchRange('4','7'); - } - { - _loop330: - do { - if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mDigit(false); - } - else { - break _loop330; - } - - } while (true); - } - break; - } - case 'x': - { - match('x'); - { - int _cnt332=0; - _loop332: - do { - if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mDigit(false); - } - else if (((LA(1) >= 'a' && LA(1) <= 'f')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - matchRange('a','f'); - } - else if (((LA(1) >= 'A' && LA(1) <= 'F')) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - matchRange('A','F'); - } - else { - if ( _cnt332>=1 ) { break _loop332; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt332++; - } while (true); - } - break; - } - default: - if ((_tokenSet_1.member(LA(1)))) { - { - match(_tokenSet_1); - } - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mDigit(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Digit; - int _saveIndex; - - matchRange('0','9'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mIntSuffix(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = IntSuffix; - int _saveIndex; - - switch ( LA(1)) { - case 'L': - { - match('L'); - break; - } - case 'l': - { - match('l'); - break; - } - case 'U': - { - match('U'); - break; - } - case 'u': - { - match('u'); - break; - } - case 'I': - { - match('I'); - break; - } - case 'i': - { - match('i'); - break; - } - case 'J': - { - match('J'); - break; - } - case 'j': - { - match('j'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mNumberSuffix(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = NumberSuffix; - int _saveIndex; - - switch ( LA(1)) { - case 'I': case 'J': case 'L': case 'U': - case 'i': case 'j': case 'l': case 'u': - { - mIntSuffix(false); - break; - } - case 'F': - { - match('F'); - break; - } - case 'f': - { - match('f'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mNumber(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Number; - int _saveIndex; - - boolean synPredMatched340 = false; - if ((((LA(1) >= '0' && LA(1) <= '9')) && (_tokenSet_2.member(LA(2))) && (true))) { - int _m340 = mark(); - synPredMatched340 = true; - inputState.guessing++; - try { - { - { - int _cnt338=0; - _loop338: - do { - if (((LA(1) >= '0' && LA(1) <= '9'))) { - mDigit(false); - } - else { - if ( _cnt338>=1 ) { break _loop338; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt338++; - } while (true); - } - { - switch ( LA(1)) { - case '.': - { - match('.'); - break; - } - case 'e': - { - match('e'); - break; - } - case 'E': - { - match('E'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - } - } - catch (RecognitionException pe) { - synPredMatched340 = false; - } - rewind(_m340); - inputState.guessing--; - } - if ( synPredMatched340 ) { - { - int _cnt342=0; - _loop342: - do { - if (((LA(1) >= '0' && LA(1) <= '9'))) { - mDigit(false); - } - else { - if ( _cnt342>=1 ) { break _loop342; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt342++; - } while (true); - } - { - switch ( LA(1)) { - case '.': - { - match('.'); - { - _loop345: - do { - if (((LA(1) >= '0' && LA(1) <= '9'))) { - mDigit(false); - } - else { - break _loop345; - } - - } while (true); - } - { - if ((LA(1)=='E'||LA(1)=='e')) { - mExponent(false); - } - else { - } - - } - break; - } - case 'E': case 'e': - { - mExponent(false); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - { - _loop348: - do { - if ((_tokenSet_3.member(LA(1)))) { - mNumberSuffix(false); - } - else { - break _loop348; - } - - } while (true); - } - } - else { - boolean synPredMatched350 = false; - if (((LA(1)=='.') && (LA(2)=='.'))) { - int _m350 = mark(); - synPredMatched350 = true; - inputState.guessing++; - try { - { - match("..."); - } - } - catch (RecognitionException pe) { - synPredMatched350 = false; - } - rewind(_m350); - inputState.guessing--; - } - if ( synPredMatched350 ) { - match("..."); - if ( inputState.guessing==0 ) { - _ttype = VARARGS; - } - } - else if ((LA(1)=='0') && (LA(2)=='X'||LA(2)=='x')) { - match('0'); - { - switch ( LA(1)) { - case 'x': - { - match('x'); - break; - } - case 'X': - { - match('X'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - { - int _cnt367=0; - _loop367: - do { - switch ( LA(1)) { - case 'a': case 'b': case 'c': case 'd': - case 'e': case 'f': - { - matchRange('a','f'); - break; - } - case 'A': case 'B': case 'C': case 'D': - case 'E': case 'F': - { - matchRange('A','F'); - break; - } - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - case '8': case '9': - { - mDigit(false); - break; - } - default: - { - if ( _cnt367>=1 ) { break _loop367; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - } - _cnt367++; - } while (true); - } - { - _loop369: - do { - if ((_tokenSet_4.member(LA(1)))) { - mIntSuffix(false); - } - else { - break _loop369; - } - - } while (true); - } - } - else if ((LA(1)=='.') && (true)) { - match('.'); - if ( inputState.guessing==0 ) { - _ttype = DOT; - } - { - if (((LA(1) >= '0' && LA(1) <= '9'))) { - { - int _cnt353=0; - _loop353: - do { - if (((LA(1) >= '0' && LA(1) <= '9'))) { - mDigit(false); - } - else { - if ( _cnt353>=1 ) { break _loop353; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt353++; - } while (true); - } - { - if ((LA(1)=='E'||LA(1)=='e')) { - mExponent(false); - } - else { - } - - } - if ( inputState.guessing==0 ) { - _ttype = Number; - } - { - _loop356: - do { - if ((_tokenSet_3.member(LA(1)))) { - mNumberSuffix(false); - } - else { - break _loop356; - } - - } while (true); - } - } - else { - } - - } - } - else if ((LA(1)=='0') && (true) && (true)) { - match('0'); - { - _loop358: - do { - if (((LA(1) >= '0' && LA(1) <= '7'))) { - matchRange('0','7'); - } - else { - break _loop358; - } - - } while (true); - } - { - _loop360: - do { - if ((_tokenSet_3.member(LA(1)))) { - mNumberSuffix(false); - } - else { - break _loop360; - } - - } while (true); - } - } - else if (((LA(1) >= '1' && LA(1) <= '9')) && (true) && (true)) { - matchRange('1','9'); - { - _loop362: - do { - if (((LA(1) >= '0' && LA(1) <= '9'))) { - mDigit(false); - } - else { - break _loop362; - } - - } while (true); - } - { - _loop364: - do { - if ((_tokenSet_3.member(LA(1)))) { - mNumberSuffix(false); - } - else { - break _loop364; - } - - } while (true); - } - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mExponent(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Exponent; - int _saveIndex; - - { - switch ( LA(1)) { - case 'e': - { - match('e'); - break; - } - case 'E': - { - match('E'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - { - switch ( LA(1)) { - case '+': - { - match('+'); - break; - } - case '-': - { - match('-'); - break; - } - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - case '8': case '9': - { - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - { - int _cnt487=0; - _loop487: - do { - if (((LA(1) >= '0' && LA(1) <= '9'))) { - mDigit(false); - } - else { - if ( _cnt487>=1 ) { break _loop487; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt487++; - } while (true); - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mIDMEAT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = IDMEAT; - int _saveIndex; - Token i=null; - - mID(true); - i=_returnToken; - if ( inputState.guessing==0 ) { - - - if ( i.getType() == LITERAL___extension__ ) { - _ttype = Token.SKIP; - } - else { - _ttype = i.getType(); - } - - - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = ID; - int _saveIndex; - - { - switch ( LA(1)) { - case 'a': case 'b': case 'c': case 'd': - case 'e': case 'f': case 'g': case 'h': - case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': - case 'q': case 'r': case 's': case 't': - case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - { - matchRange('a','z'); - break; - } - case 'A': case 'B': case 'C': case 'D': - case 'E': case 'F': case 'G': case 'H': - case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': - case 'Q': case 'R': case 'S': case 'T': - case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - { - matchRange('A','Z'); - break; - } - case '_': - { - match('_'); - break; - } - case '$': - { - match('$'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - { - _loop374: - do { - if (((LA(1) >= 'a' && LA(1) <= 'z')) && (true) && (true)) { - matchRange('a','z'); - } - else if (((LA(1) >= 'A' && LA(1) <= 'Z')) && (true) && (true)) { - matchRange('A','Z'); - } - else if ((LA(1)=='_') && (true) && (true)) { - match('_'); - } - else if ((LA(1)=='$') && (true) && (true)) { - match('$'); - } - else if (((LA(1) >= '0' && LA(1) <= '9')) && (true) && (true)) { - matchRange('0','9'); - } - else { - break _loop374; - } - - } while (true); - } - _ttype = testLiteralsTable(new String(text.getBuffer(),_begin,text.length()-_begin),_ttype); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mWideCharLiteral(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = WideCharLiteral; - int _saveIndex; - - match('L'); - mCharLiteral(false); - if ( inputState.guessing==0 ) { - _ttype = CharLiteral; - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mCharLiteral(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = CharLiteral; - int _saveIndex; - - match('\''); - { - if ((LA(1)=='\\') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (_tokenSet_5.member(LA(3)))) { - mEscape(false); - } - else if ((_tokenSet_6.member(LA(1))) && (LA(2)=='\'') && (true)) { - { - match(_tokenSet_6); - } - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - match('\''); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mWideStringLiteral(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = WideStringLiteral; - int _saveIndex; - - match('L'); - mStringLiteral(false); - if ( inputState.guessing==0 ) { - _ttype = StringLiteral; - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mStringLiteral(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = StringLiteral; - int _saveIndex; - - match('"'); - { - _loop384: - do { - boolean synPredMatched381 = false; - if (((LA(1)=='\\') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff')))) { - int _m381 = mark(); - synPredMatched381 = true; - inputState.guessing++; - try { - { - match('\\'); - { - match(_tokenSet_7); - } - } - } - catch (RecognitionException pe) { - synPredMatched381 = false; - } - rewind(_m381); - inputState.guessing--; - } - if ( synPredMatched381 ) { - mEscape(false); - } - else if ((LA(1)=='\n'||LA(1)=='\r'||LA(1)=='\\') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - { - switch ( LA(1)) { - case '\r': - { - match('\r'); - if ( inputState.guessing==0 ) { - newline(); - } - break; - } - case '\n': - { - match('\n'); - if ( inputState.guessing==0 ) { - - newline(); - - } - break; - } - case '\\': - { - match('\\'); - match('\n'); - if ( inputState.guessing==0 ) { - - newline(); - - } - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - } - else if ((_tokenSet_8.member(LA(1)))) { - { - match(_tokenSet_8); - } - } - else { - break _loop384; - } - - } while (true); - } - match('"'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mVocabulary(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Vocabulary; - int _saveIndex; - - matchRange('\3','\377'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = ASSIGN; - int _saveIndex; - - match('='); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mCOLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = COLON; - int _saveIndex; - - match(':'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = COMMA; - int _saveIndex; - - match(','); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mQUESTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = QUESTION; - int _saveIndex; - - match('?'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = SEMI; - int _saveIndex; - - match(';'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mPTR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = PTR; - int _saveIndex; - - match("->"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mDOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = DOT; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mVARARGS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = VARARGS; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LPAREN; - int _saveIndex; - - match('('); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = RPAREN; - int _saveIndex; - - match(')'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLBRACKET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LBRACKET; - int _saveIndex; - - match('['); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mRBRACKET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = RBRACKET; - int _saveIndex; - - match(']'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LCURLY; - int _saveIndex; - - match('{'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mRCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = RCURLY; - int _saveIndex; - - match('}'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mEQUAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = EQUAL; - int _saveIndex; - - match("=="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mNOT_EQUAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = NOT_EQUAL; - int _saveIndex; - - match("!="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LTE; - int _saveIndex; - - match("<="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LT; - int _saveIndex; - - match("<"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mGTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = GTE; - int _saveIndex; - - match(">="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mGT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = GT; - int _saveIndex; - - match(">"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mDIV(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = DIV; - int _saveIndex; - - match('/'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mDIV_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = DIV_ASSIGN; - int _saveIndex; - - match("/="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mPLUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = PLUS; - int _saveIndex; - - match('+'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mPLUS_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = PLUS_ASSIGN; - int _saveIndex; - - match("+="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mINC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = INC; - int _saveIndex; - - match("++"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mMINUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = MINUS; - int _saveIndex; - - match('-'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mMINUS_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = MINUS_ASSIGN; - int _saveIndex; - - match("-="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mDEC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = DEC; - int _saveIndex; - - match("--"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mSTAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = STAR; - int _saveIndex; - - match('*'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mSTAR_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = STAR_ASSIGN; - int _saveIndex; - - match("*="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mMOD(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = MOD; - int _saveIndex; - - match('%'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mMOD_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = MOD_ASSIGN; - int _saveIndex; - - match("%="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mRSHIFT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = RSHIFT; - int _saveIndex; - - match(">>"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mRSHIFT_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = RSHIFT_ASSIGN; - int _saveIndex; - - match(">>="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLSHIFT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LSHIFT; - int _saveIndex; - - match("<<"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLSHIFT_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LSHIFT_ASSIGN; - int _saveIndex; - - match("<<="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLAND(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LAND; - int _saveIndex; - - match("&&"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLNOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LNOT; - int _saveIndex; - - match('!'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LOR; - int _saveIndex; - - match("||"); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mBAND(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BAND; - int _saveIndex; - - match('&'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mBAND_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BAND_ASSIGN; - int _saveIndex; - - match("&="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mBNOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BNOT; - int _saveIndex; - - match('~'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mBOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BOR; - int _saveIndex; - - match('|'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mBOR_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BOR_ASSIGN; - int _saveIndex; - - match("|="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mBXOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BXOR; - int _saveIndex; - - match('^'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mBXOR_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BXOR_ASSIGN; - int _saveIndex; - - match("^="); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mComment(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Comment; - int _saveIndex; - - match("/*"); - { - _loop436: - do { - if (((LA(1)=='*') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff')))&&( LA(2) != '/' )) { - match('*'); - } - else if ((LA(1)=='\r') && (LA(2)=='\n') && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { - match("\r\n"); - if ( inputState.guessing==0 ) { - deferredNewline(); - } - } - else if ((LA(1)=='\n'||LA(1)=='\r') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { - { - switch ( LA(1)) { - case '\r': - { - match('\r'); - break; - } - case '\n': - { - match('\n'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - if ( inputState.guessing==0 ) { - deferredNewline(); - } - } - else if ((_tokenSet_9.member(LA(1)))) { - { - match(_tokenSet_9); - } - } - else { - break _loop436; - } - - } while (true); - } - match("*/"); - if ( inputState.guessing==0 ) { - _ttype = Token.SKIP; - - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mCPPComment(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = CPPComment; - int _saveIndex; - - match("//"); - { - _loop440: - do { - if ((_tokenSet_7.member(LA(1)))) { - { - match(_tokenSet_7); - } - } - else { - break _loop440; - } - - } while (true); - } - if ( inputState.guessing==0 ) { - - _ttype = Token.SKIP; - - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mPREPROC_DIRECTIVE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = PREPROC_DIRECTIVE; - int _saveIndex; - - match('#'); - { - boolean synPredMatched447 = false; - if (((_tokenSet_10.member(LA(1))) && (_tokenSet_11.member(LA(2))) && (_tokenSet_12.member(LA(3))))) { - int _m447 = mark(); - synPredMatched447 = true; - inputState.guessing++; - try { - { - switch ( LA(1)) { - case 'l': - { - match("line"); - break; - } - case '\t': case '\u000c': case ' ': - { - { - { - int _cnt446=0; - _loop446: - do { - switch ( LA(1)) { - case ' ': - { - match(' '); - break; - } - case '\t': - { - match('\t'); - break; - } - case '\u000c': - { - match('\014'); - break; - } - default: - { - if ( _cnt446>=1 ) { break _loop446; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - } - _cnt446++; - } while (true); - } - matchRange('0','9'); - } - break; - } - default: - { - } - } - } - } - catch (RecognitionException pe) { - synPredMatched447 = false; - } - rewind(_m447); - inputState.guessing--; - } - if ( synPredMatched447 ) { - mLineDirective(false); - } - else { - { - _loop449: - do { - if ((_tokenSet_7.member(LA(1)))) { - matchNot('\n'); - } - else { - break _loop449; - } - - } while (true); - } - if ( inputState.guessing==0 ) { - setPreprocessingDirective(getText()); - } - } - - } - if ( inputState.guessing==0 ) { - - _ttype = Token.SKIP; - - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mLineDirective(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LineDirective; - int _saveIndex; - Token n=null; - Token fn=null; - Token fi=null; - - boolean oldCountingTokens = countingTokens; - countingTokens = false; - - - if ( inputState.guessing==0 ) { - - lineObject = new LineObject(); - deferredLineCount = 0; - - } - { - switch ( LA(1)) { - case 'l': - { - match("line"); - break; - } - case '\t': case '\u000c': case ' ': - { - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - { - int _cnt455=0; - _loop455: - do { - if ((LA(1)=='\t'||LA(1)=='\u000c'||LA(1)==' ')) { - mSpace(false); - } - else { - if ( _cnt455>=1 ) { break _loop455; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt455++; - } while (true); - } - mNumber(true); - n=_returnToken; - if ( inputState.guessing==0 ) { - lineObject.setLine(Integer.parseInt(n.getText())); - } - { - int _cnt457=0; - _loop457: - do { - if ((LA(1)=='\t'||LA(1)=='\u000c'||LA(1)==' ') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mSpace(false); - } - else { - if ( _cnt457>=1 ) { break _loop457; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt457++; - } while (true); - } - { - if ((LA(1)=='"') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) { - mStringLiteral(true); - fn=_returnToken; - if ( inputState.guessing==0 ) { - try { - lineObject.setSource(fn.getText().substring(1,fn.getText().length()-1)); - } - catch (StringIndexOutOfBoundsException e) { /*not possible*/ } - - } - } - else if ((_tokenSet_0.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mID(true); - fi=_returnToken; - if ( inputState.guessing==0 ) { - lineObject.setSource(fi.getText()); - } - } - else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - { - _loop460: - do { - if ((LA(1)=='\t'||LA(1)=='\u000c'||LA(1)==' ') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mSpace(false); - } - else { - break _loop460; - } - - } while (true); - } - { - if ((LA(1)=='1') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - match("1"); - if ( inputState.guessing==0 ) { - lineObject.setEnteringFile(true); - } - } - else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - { - _loop463: - do { - if ((LA(1)=='\t'||LA(1)=='\u000c'||LA(1)==' ') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mSpace(false); - } - else { - break _loop463; - } - - } while (true); - } - { - if ((LA(1)=='2') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - match("2"); - if ( inputState.guessing==0 ) { - lineObject.setReturningToFile(true); - } - } - else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - { - _loop466: - do { - if ((LA(1)=='\t'||LA(1)=='\u000c'||LA(1)==' ') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mSpace(false); - } - else { - break _loop466; - } - - } while (true); - } - { - if ((LA(1)=='3') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - match("3"); - if ( inputState.guessing==0 ) { - lineObject.setSystemHeader(true); - } - } - else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - { - _loop469: - do { - if ((LA(1)=='\t'||LA(1)=='\u000c'||LA(1)==' ') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - mSpace(false); - } - else { - break _loop469; - } - - } while (true); - } - { - if ((LA(1)=='4') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) { - match("4"); - if ( inputState.guessing==0 ) { - lineObject.setTreatAsC(true); - } - } - else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) { - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - { - _loop473: - do { - if ((_tokenSet_13.member(LA(1)))) { - { - match(_tokenSet_13); - } - } - else { - break _loop473; - } - - } while (true); - } - { - if ((LA(1)=='\r') && (LA(2)=='\n')) { - match("\r\n"); - } - else if ((LA(1)=='\r') && (true)) { - match("\r"); - } - else if ((LA(1)=='\n')) { - match("\n"); - } - else { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - - } - if ( inputState.guessing==0 ) { - - preprocessorInfoChannel.addLineForTokenNumber(new LineObject(lineObject), new Integer(tokenNumber)); - countingTokens = oldCountingTokens; - - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mSpace(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = Space; - int _saveIndex; - - { - switch ( LA(1)) { - case ' ': - { - match(' '); - break; - } - case '\t': - { - match('\t'); - break; - } - case '\u000c': - { - match('\014'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mBadStringLiteral(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = BadStringLiteral; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mLongSuffix(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LongSuffix; - int _saveIndex; - - switch ( LA(1)) { - case 'l': - { - match('l'); - break; - } - case 'L': - { - match('L'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mUnsignedSuffix(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = UnsignedSuffix; - int _saveIndex; - - switch ( LA(1)) { - case 'u': - { - match('u'); - break; - } - case 'U': - { - match('U'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mFloatSuffix(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = FloatSuffix; - int _saveIndex; - - switch ( LA(1)) { - case 'f': - { - match('f'); - break; - } - case 'F': - { - match('F'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mDoubleDoubleConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = DoubleDoubleConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mFloatDoubleConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = FloatDoubleConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mLongDoubleConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LongDoubleConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mIntOctalConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = IntOctalConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mLongOctalConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LongOctalConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mUnsignedOctalConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = UnsignedOctalConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mIntIntConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = IntIntConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mLongIntConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LongIntConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mUnsignedIntConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = UnsignedIntConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mIntHexConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = IntHexConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mLongHexConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LongHexConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - protected final void mUnsignedHexConst(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = UnsignedHexConst; - int _saveIndex; - - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - - private static final long[] mk_tokenSet_0() { - long[] data = { 68719476736L, 576460745995190270L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); - private static final long[] mk_tokenSet_1() { - long[] data = new long[8]; - data[0]=-71776119061217288L; - data[1]=-72057594037927937L; - for (int i = 2; i<=3; i++) { data[i]=-1L; } - return data; - } - public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); - private static final long[] mk_tokenSet_2() { - long[] data = { 288019269919178752L, 137438953504L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); - private static final long[] mk_tokenSet_3() { - long[] data = { 0L, 9031663390561856L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3()); - private static final long[] mk_tokenSet_4() { - long[] data = { 0L, 9031388512654848L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4()); - private static final long[] mk_tokenSet_5() { - long[] data = { 287949450930814976L, 541165879422L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5()); - private static final long[] mk_tokenSet_6() { - long[] data = new long[8]; - data[0]=-549755813896L; - for (int i = 1; i<=3; i++) { data[i]=-1L; } - return data; - } - public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6()); - private static final long[] mk_tokenSet_7() { - long[] data = new long[8]; - data[0]=-1032L; - for (int i = 1; i<=3; i++) { data[i]=-1L; } - return data; - } - public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7()); - private static final long[] mk_tokenSet_8() { - long[] data = new long[8]; - data[0]=-17179878408L; - data[1]=-268435457L; - for (int i = 2; i<=3; i++) { data[i]=-1L; } - return data; - } - public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8()); - private static final long[] mk_tokenSet_9() { - long[] data = new long[8]; - data[0]=-4398046520328L; - for (int i = 1; i<=3; i++) { data[i]=-1L; } - return data; - } - public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9()); - private static final long[] mk_tokenSet_10() { - long[] data = { 4294971904L, 17592186044416L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_10 = new BitSet(mk_tokenSet_10()); - private static final long[] mk_tokenSet_11() { - long[] data = { 288019274214150656L, 2199023255552L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_11 = new BitSet(mk_tokenSet_11()); - private static final long[] mk_tokenSet_12() { - long[] data = { 288019274214150656L, 81159763628398176L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_12 = new BitSet(mk_tokenSet_12()); - private static final long[] mk_tokenSet_13() { - long[] data = new long[8]; - data[0]=-9224L; - for (int i = 1; i<=3; i++) { data[i]=-1L; } - return data; - } - public static final BitSet _tokenSet_13 = new BitSet(mk_tokenSet_13()); - - } diff --git a/app/preproc/WLexerTokenTypes.java b/app/preproc/WLexerTokenTypes.java deleted file mode 100644 index c9eb47159..000000000 --- a/app/preproc/WLexerTokenTypes.java +++ /dev/null @@ -1,168 +0,0 @@ -// $ANTLR 2.7.2: "expandedWParser.g" -> "WLexer.java"$ - -package processing.app.preproc; - -import java.io.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; - -public interface WLexerTokenTypes { - int EOF = 1; - int NULL_TREE_LOOKAHEAD = 3; - int LITERAL_typedef = 4; - int LITERAL_asm = 5; - int LITERAL_volatile = 6; - int LCURLY = 7; - int RCURLY = 8; - int SEMI = 9; - int LITERAL_struct = 10; - int LITERAL_union = 11; - int LITERAL_enum = 12; - int LITERAL_auto = 13; - int LITERAL_register = 14; - int LITERAL_extern = 15; - int LITERAL_static = 16; - int LITERAL_const = 17; - int LITERAL_void = 18; - int LITERAL_char = 19; - int LITERAL_short = 20; - int LITERAL_int = 21; - int LITERAL_long = 22; - int LITERAL_float = 23; - int LITERAL_double = 24; - int LITERAL_signed = 25; - int LITERAL_unsigned = 26; - int ID = 27; - int COMMA = 28; - int COLON = 29; - int ASSIGN = 30; - int STAR = 31; - int LPAREN = 32; - int RPAREN = 33; - int LBRACKET = 34; - int RBRACKET = 35; - int VARARGS = 36; - int LITERAL_while = 37; - int LITERAL_do = 38; - int LITERAL_for = 39; - int LITERAL_goto = 40; - int LITERAL_continue = 41; - int LITERAL_break = 42; - int LITERAL_return = 43; - int LITERAL_case = 44; - int LITERAL_default = 45; - int LITERAL_if = 46; - int LITERAL_else = 47; - int LITERAL_switch = 48; - int DIV_ASSIGN = 49; - int PLUS_ASSIGN = 50; - int MINUS_ASSIGN = 51; - int STAR_ASSIGN = 52; - int MOD_ASSIGN = 53; - int RSHIFT_ASSIGN = 54; - int LSHIFT_ASSIGN = 55; - int BAND_ASSIGN = 56; - int BOR_ASSIGN = 57; - int BXOR_ASSIGN = 58; - int QUESTION = 59; - int LOR = 60; - int LAND = 61; - int BOR = 62; - int BXOR = 63; - int BAND = 64; - int EQUAL = 65; - int NOT_EQUAL = 66; - int LT = 67; - int LTE = 68; - int GT = 69; - int GTE = 70; - int LSHIFT = 71; - int RSHIFT = 72; - int PLUS = 73; - int MINUS = 74; - int DIV = 75; - int MOD = 76; - int INC = 77; - int DEC = 78; - int LITERAL_sizeof = 79; - int BNOT = 80; - int LNOT = 81; - int PTR = 82; - int DOT = 83; - int CharLiteral = 84; - int StringLiteral = 85; - int IntOctalConst = 86; - int LongOctalConst = 87; - int UnsignedOctalConst = 88; - int IntIntConst = 89; - int LongIntConst = 90; - int UnsignedIntConst = 91; - int IntHexConst = 92; - int LongHexConst = 93; - int UnsignedHexConst = 94; - int FloatDoubleConst = 95; - int DoubleDoubleConst = 96; - int LongDoubleConst = 97; - int NTypedefName = 98; - int NInitDecl = 99; - int NDeclarator = 100; - int NStructDeclarator = 101; - int NDeclaration = 102; - int NCast = 103; - int NPointerGroup = 104; - int NExpressionGroup = 105; - int NFunctionCallArgs = 106; - int NNonemptyAbstractDeclarator = 107; - int NInitializer = 108; - int NStatementExpr = 109; - int NEmptyExpression = 110; - int NParameterTypeList = 111; - int NFunctionDef = 112; - int NCompoundStatement = 113; - int NParameterDeclaration = 114; - int NCommaExpr = 115; - int NUnaryExpr = 116; - int NLabel = 117; - int NPostfixExpr = 118; - int NRangeExpr = 119; - int NStringSeq = 120; - int NInitializerElementLabel = 121; - int NLcurlyInitializer = 122; - int NAsmAttribute = 123; - int NGnuAsmExpr = 124; - int NTypeMissing = 125; - int Vocabulary = 126; - int Whitespace = 127; - int Comment = 128; - int CPPComment = 129; - int PREPROC_DIRECTIVE = 130; - int Space = 131; - int LineDirective = 132; - int BadStringLiteral = 133; - int Escape = 134; - int Digit = 135; - int LongSuffix = 136; - int UnsignedSuffix = 137; - int FloatSuffix = 138; - int Exponent = 139; - int Number = 140; - int LITERAL___label__ = 141; - int LITERAL_inline = 142; - int LITERAL_byte = 143; - int LITERAL_boolean = 144; - int LITERAL_Servo = 145; - int LITERAL_Wire = 146; - int LITERAL_typeof = 147; - int LITERAL___complex = 148; - int LITERAL___attribute = 149; - int LITERAL___alignof = 150; - int LITERAL___real = 151; - int LITERAL___imag = 152; - int LITERAL___extension__ = 153; - int IntSuffix = 154; - int NumberSuffix = 155; - int IDMEAT = 156; - int WideCharLiteral = 157; - int WideStringLiteral = 158; -} diff --git a/app/preproc/WLexerTokenTypes.txt b/app/preproc/WLexerTokenTypes.txt deleted file mode 100644 index ed1cc1589..000000000 --- a/app/preproc/WLexerTokenTypes.txt +++ /dev/null @@ -1,157 +0,0 @@ -// $ANTLR 2.7.2: expandedWParser.g -> WLexerTokenTypes.txt$ -WLexer // output token vocab name -LITERAL_typedef="typedef"=4 -LITERAL_asm="asm"=5 -LITERAL_volatile="volatile"=6 -LCURLY=7 -RCURLY=8 -SEMI=9 -LITERAL_struct="struct"=10 -LITERAL_union="union"=11 -LITERAL_enum="enum"=12 -LITERAL_auto="auto"=13 -LITERAL_register="register"=14 -LITERAL_extern="extern"=15 -LITERAL_static="static"=16 -LITERAL_const="const"=17 -LITERAL_void="void"=18 -LITERAL_char="char"=19 -LITERAL_short="short"=20 -LITERAL_int="int"=21 -LITERAL_long="long"=22 -LITERAL_float="float"=23 -LITERAL_double="double"=24 -LITERAL_signed="signed"=25 -LITERAL_unsigned="unsigned"=26 -ID=27 -COMMA=28 -COLON=29 -ASSIGN=30 -STAR=31 -LPAREN=32 -RPAREN=33 -LBRACKET=34 -RBRACKET=35 -VARARGS=36 -LITERAL_while="while"=37 -LITERAL_do="do"=38 -LITERAL_for="for"=39 -LITERAL_goto="goto"=40 -LITERAL_continue="continue"=41 -LITERAL_break="break"=42 -LITERAL_return="return"=43 -LITERAL_case="case"=44 -LITERAL_default="default"=45 -LITERAL_if="if"=46 -LITERAL_else="else"=47 -LITERAL_switch="switch"=48 -DIV_ASSIGN=49 -PLUS_ASSIGN=50 -MINUS_ASSIGN=51 -STAR_ASSIGN=52 -MOD_ASSIGN=53 -RSHIFT_ASSIGN=54 -LSHIFT_ASSIGN=55 -BAND_ASSIGN=56 -BOR_ASSIGN=57 -BXOR_ASSIGN=58 -QUESTION=59 -LOR=60 -LAND=61 -BOR=62 -BXOR=63 -BAND=64 -EQUAL=65 -NOT_EQUAL=66 -LT=67 -LTE=68 -GT=69 -GTE=70 -LSHIFT=71 -RSHIFT=72 -PLUS=73 -MINUS=74 -DIV=75 -MOD=76 -INC=77 -DEC=78 -LITERAL_sizeof="sizeof"=79 -BNOT=80 -LNOT=81 -PTR=82 -DOT=83 -CharLiteral=84 -StringLiteral=85 -IntOctalConst=86 -LongOctalConst=87 -UnsignedOctalConst=88 -IntIntConst=89 -LongIntConst=90 -UnsignedIntConst=91 -IntHexConst=92 -LongHexConst=93 -UnsignedHexConst=94 -FloatDoubleConst=95 -DoubleDoubleConst=96 -LongDoubleConst=97 -NTypedefName=98 -NInitDecl=99 -NDeclarator=100 -NStructDeclarator=101 -NDeclaration=102 -NCast=103 -NPointerGroup=104 -NExpressionGroup=105 -NFunctionCallArgs=106 -NNonemptyAbstractDeclarator=107 -NInitializer=108 -NStatementExpr=109 -NEmptyExpression=110 -NParameterTypeList=111 -NFunctionDef=112 -NCompoundStatement=113 -NParameterDeclaration=114 -NCommaExpr=115 -NUnaryExpr=116 -NLabel=117 -NPostfixExpr=118 -NRangeExpr=119 -NStringSeq=120 -NInitializerElementLabel=121 -NLcurlyInitializer=122 -NAsmAttribute=123 -NGnuAsmExpr=124 -NTypeMissing=125 -Vocabulary=126 -Whitespace=127 -Comment=128 -CPPComment=129 -PREPROC_DIRECTIVE("a line directive")=130 -Space=131 -LineDirective=132 -BadStringLiteral=133 -Escape=134 -Digit=135 -LongSuffix=136 -UnsignedSuffix=137 -FloatSuffix=138 -Exponent=139 -Number=140 -LITERAL___label__="__label__"=141 -LITERAL_inline="inline"=142 -LITERAL_byte="byte"=143 -LITERAL_boolean="boolean"=144 -LITERAL_Servo="Servo"=145 -LITERAL_Wire="Wire"=146 -LITERAL_typeof="typeof"=147 -LITERAL___complex="__complex"=148 -LITERAL___attribute="__attribute"=149 -LITERAL___alignof="__alignof"=150 -LITERAL___real="__real"=151 -LITERAL___imag="__imag"=152 -LITERAL___extension__="__extension__"=153 -IntSuffix=154 -NumberSuffix=155 -IDMEAT=156 -WideCharLiteral=157 -WideStringLiteral=158 diff --git a/app/preproc/WParser.g b/app/preproc/WParser.g deleted file mode 100755 index ba2fcb2d2..000000000 --- a/app/preproc/WParser.g +++ /dev/null @@ -1,856 +0,0 @@ -/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - Copyright (c) Non, Inc. 1998 -- All Rights Reserved - -PROJECT: C Compiler -MODULE: WParser -FILE: WParser.g - -AUTHOR: Monty Zukowski (jamz@cdsnet.net) April 28, 1998 -MODIFICATIONS: Hernando Barragan added support for the Wiring language -DESCRIPTION: - This is a grammar for the GNU C compiler. It is a - grammar subclass of StdCParser, overriding only those - rules which are different from Standard C. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ - - -header { -package processing.app.preproc; - -import java.io.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; -} - - -class WParser extends StdCParser; - -options - { - k = 2; - exportVocab = W; - buildAST = true; - ASTLabelType = "TNode"; - defaultErrorHandler = false; - // Copied following options from java grammar. - codeGenMakeSwitchThreshold = 2; - codeGenBitsetTestThreshold = 3; - } - - -{ - // Suppport C++-style single-line comments? - public static boolean CPPComments = true; - - // access to symbol table - public CSymbolTable symbolTable = new CSymbolTable(); - - // source for names to unnamed scopes - protected int unnamedScopeCounter = 0; - - public boolean isTypedefName(String name) { - boolean returnValue = false; - TNode node = symbolTable.lookupNameInCurrentScope(name); - for (; node != null; node = (TNode) node.getNextSibling() ) { - if(node.getType() == LITERAL_typedef) { - returnValue = true; - break; - } - } - return returnValue; - } - - - public String getAScopeName() { - return "" + (unnamedScopeCounter++); - } - - public void pushScope(String scopeName) { - symbolTable.pushScope(scopeName); - } - - public void popScope() { - symbolTable.popScope(); - } - - int traceDepth = 0; - public void reportError(RecognitionException ex) { - try { - System.err.println("ANTLR Parsing Error: "+ex + " token name:" + tokenNames[LA(1)]); - ex.printStackTrace(System.err); - } - catch (TokenStreamException e) { - System.err.println("ANTLR Parsing Error: "+ex); - ex.printStackTrace(System.err); - } - } - public void reportError(String s) { - System.err.println("ANTLR Parsing Error from String: " + s); - } - public void reportWarning(String s) { - System.err.println("ANTLR Parsing Warning from String: " + s); - } - public void match(int t) throws MismatchedTokenException { - boolean debugging = false; - - if ( debugging ) { - for (int x=0; x0)?" [inputState.guessing "+ inputState.guessing + "]":"")); - - } - - } - try { - if ( LA(1)!=t ) { - if ( debugging ){ - for (int x=0; x "+rname+"; LA(1)==("+ tokenNames[LT(1).getType()] - + ") " + LT(1).getText() + " [inputState.guessing "+ inputState.guessing + "]"); - } - catch (TokenStreamException e) { - } - } - public void traceOut(String rname) { - for (int x=0; x declaration - | ( functionPrefix )=> functionDef - | typelessDeclaration - | asm_expr - | SEMI - ; - -/* these two are here because GCC allows "cat = 13;" as a valid program! */ -functionPrefix - { String declName; } - : ( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers - | //epsilon - ) - declName = d:declarator[true] - ( declaration )* (VARARGS)? ( SEMI )* - LCURLY - ; - -typelessDeclaration - { AST typeMissing = #[NTypeMissing]; } - : initDeclList[typeMissing] SEMI { ## = #( #[NTypeMissing], ##); } - ; - -initializer - : ( ( ( (initializerElementLabel)=> initializerElementLabel )? - ( assignExpr | lcurlyInitializer ) { ## = #( #[NInitializer], ## ); } - ) - | lcurlyInitializer - ) - ; - -// GCC allows more specific initializers -initializerElementLabel - : ( ( LBRACKET ((constExpr VARARGS)=> rangeExpr | constExpr) RBRACKET (ASSIGN)? ) - | ID COLON - | DOT ID ASSIGN - ) - { ## = #( #[NInitializerElementLabel], ##) ; } - ; - -// GCC allows empty initializer lists -lcurlyInitializer - : - LCURLY^ (initializerList ( COMMA! )? )? RCURLY - { ##.setType( NLcurlyInitializer ); } - ; - -initializerList - : initializer ( options{warnWhenFollowAmbig=false;}:COMMA! initializer )* - ; - - -declarator[boolean isFunctionDefinition] returns [String declName] - { declName = ""; } - : - ( pointerGroup )? - - ( id:ID { declName = id.getText(); } - | LPAREN declName = declarator[false] RPAREN - ) - - ( declaratorParamaterList[isFunctionDefinition, declName] - | LBRACKET ( expr )? RBRACKET - )* - { ## = #( #[NDeclarator], ## ); } - ; - -declaratorParamaterList[boolean isFunctionDefinition, String declName] - : - LPAREN^ - { - if (isFunctionDefinition) { - pushScope(declName); - } - else { - pushScope("!"+declName); - } - } - ( - (declSpecifiers)=> parameterTypeList - | (idList)? - ) - { - popScope(); - } - ( COMMA! )? - RPAREN - { ##.setType(NParameterTypeList); } - ; - -parameterTypeList - : parameterDeclaration - ( options { - warnWhenFollowAmbig = false; - } : - ( COMMA | SEMI ) - parameterDeclaration - )* - ( ( COMMA | SEMI ) - VARARGS - )? - ; - - -declarationList - : ( options { // this loop properly aborts when - // it finds a non-typedefName ID MBZ - warnWhenFollowAmbig = false; - } : - - localLabelDeclaration - | ( declarationPredictor )=> declaration - )+ - ; -localLabelDeclaration - : ( //GNU note: any __label__ declarations must come before regular declarations. - "__label__"^ ID (options{warnWhenFollowAmbig=false;}: COMMA! ID)* ( COMMA! )? ( SEMI! )+ - ) - ; - - -declaration - { AST ds1 = null; } - : ds:declSpecifiers { ds1 = astFactory.dupList(#ds); } - ( - initDeclList[ds1] - )? - ( SEMI )+ - { ## = #( #[NDeclaration], ##); } - - ; - -functionStorageClassSpecifier - : "extern" - | "static" - | "inline" - ; - -typeSpecifier [int specCount] returns [int retSpecCount] - { retSpecCount = specCount + 1; } - : - ( "void" - | "char" - | "short" - | "int" - | "long" - | "float" - | "double" - | "signed" - | "unsigned" - | "byte" - | "boolean" - | "Servo" - | "Wire" - | structOrUnionSpecifier ( options{warnWhenFollowAmbig=false;}: attributeDecl )* - | enumSpecifier - | { specCount==0 }? typedefName - | "typeof"^ LPAREN - ( ( typeName )=> typeName - | expr - ) - RPAREN - | "__complex" - ) - ; - - -structOrUnionSpecifier - { String scopeName; } - : sou:structOrUnion! - ( ( ID LCURLY )=> i:ID l:LCURLY - { - scopeName = #sou.getText() + " " + #i.getText(); - #l.setText(scopeName); - pushScope(scopeName); - } - ( structDeclarationList )? - { popScope();} - RCURLY - | l1:LCURLY - { - scopeName = getAScopeName(); - #l1.setText(scopeName); - pushScope(scopeName); - } - ( structDeclarationList )? - { popScope(); } - RCURLY - | ID - ) - { - ## = #( #sou, ## ); - } - ; - - -structDeclaration - : specifierQualifierList structDeclaratorList ( COMMA! )? ( SEMI! )+ - ; - -structDeclaratorList - : structDeclarator ( options{warnWhenFollowAmbig=false;}: COMMA! structDeclarator )* - ; - -structDeclarator - : ( declarator[false] )? - ( COLON constExpr )? - ( attributeDecl )* - { ## = #( #[NStructDeclarator], ##); } - ; - - - -enumSpecifier - : "enum"^ - ( ( ID LCURLY )=> i:ID LCURLY enumList[i.getText()] RCURLY - | LCURLY enumList["anonymous"] RCURLY - | ID - ) - ; -enumList[String enumName] - : enumerator[enumName] ( options{warnWhenFollowAmbig=false;}: COMMA! enumerator[enumName] )* ( COMMA! )? - ; - - -initDeclList[AST declarationSpecifiers] - : initDecl[declarationSpecifiers] - ( options{warnWhenFollowAmbig=false;}: COMMA! initDecl[declarationSpecifiers] )* - ( COMMA! )? - ; - -initDecl[AST declarationSpecifiers] - { String declName = ""; } - : declName = d:declarator[false] - { AST ds1, d1; - ds1 = astFactory.dupList(declarationSpecifiers); - d1 = astFactory.dupList(#d); - symbolTable.add(declName, #(null, ds1, d1) ); - } - ( attributeDecl )* - ( ASSIGN initializer - | COLON expr - )? - { ## = #( #[NInitDecl], ## ); } - ; - -attributeDecl - : "__attribute"^ LPAREN LPAREN attributeList RPAREN RPAREN - | "asm"^ LPAREN stringConst RPAREN { ##.setType( NAsmAttribute ); } - ; - -attributeList - : attribute ( options{warnWhenFollowAmbig=false;}: COMMA attribute)* ( COMMA )? - ; - -attribute - : ( ~(LPAREN | RPAREN | COMMA) - | LPAREN attributeList RPAREN - )* - ; -compoundStatement[String scopeName] - : LCURLY^ - - { - pushScope(scopeName); - } - ( //this ambiguity is ok, declarationList and nestedFunctionDef end properly - options { - warnWhenFollowAmbig = false; - } : - ( "typedef" | "__label__" | declaration )=> declarationList - | (nestedFunctionDef)=> nestedFunctionDef - )* - ( statementList )? - { popScope(); } - RCURLY - { ##.setType( NCompoundStatement ); ##.setAttribute( "scopeName", scopeName ); } - ; - -nestedFunctionDef - { String declName; } - : ( "auto" )? //only for nested functions - ( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers - )? - declName = d:declarator[false] - { - AST d2, ds2; - d2 = astFactory.dupList(#d); - ds2 = astFactory.dupList(#ds); - symbolTable.add(declName, #(null, ds2, d2)); - pushScope(declName); - } - ( declaration )* - { popScope(); } - compoundStatement[declName] - { ## = #( #[NFunctionDef], ## );} - ; - -statement - : SEMI // Empty statements - - | compoundStatement[getAScopeName()] // Group of statements - - | expr SEMI! { ## = #( #[NStatementExpr], ## );} // Expressions - -// Iteration statements: - - | "while"^ LPAREN! expr RPAREN! statement - | "do"^ statement "while"! LPAREN! expr RPAREN! SEMI! - |! "for" - LPAREN ( e1:expr )? SEMI ( e2:expr )? SEMI ( e3:expr )? RPAREN - s:statement - { - if ( #e1 == null) { #e1 = #[ NEmptyExpression ]; } - if ( #e2 == null) { #e2 = #[ NEmptyExpression ]; } - if ( #e3 == null) { #e3 = #[ NEmptyExpression ]; } - ## = #( #[LITERAL_for, "for"], #e1, #e2, #e3, #s ); - } - - -// Jump statements: - - | "goto"^ expr SEMI! - | "continue" SEMI! - | "break" SEMI! - | "return"^ ( expr )? SEMI! - - - | ID COLON! (options {warnWhenFollowAmbig=false;}: statement)? { ## = #( #[NLabel], ## ); } -// GNU allows range expressions in case statements - | "case"^ ((constExpr VARARGS)=> rangeExpr | constExpr) COLON! ( options{warnWhenFollowAmbig=false;}:statement )? - | "default"^ COLON! ( options{warnWhenFollowAmbig=false;}: statement )? - -// Selection statements: - - | "if"^ - LPAREN! expr RPAREN! statement - ( //standard if-else ambiguity - options { - warnWhenFollowAmbig = false; - } : - "else" statement )? - | "switch"^ LPAREN! expr RPAREN! statement - ; - - - -conditionalExpr - : logicalOrExpr - ( QUESTION^ (expr)? COLON conditionalExpr )? - ; - -rangeExpr //used in initializers only - : constExpr VARARGS constExpr - { ## = #(#[NRangeExpr], ##); } - ; - -castExpr - : ( LPAREN typeName RPAREN )=> - LPAREN^ typeName RPAREN ( castExpr | lcurlyInitializer ) - { ##.setType(NCast); } - - | unaryExpr - ; -nonemptyAbstractDeclarator - : ( - pointerGroup - ( (LPAREN - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - ( COMMA! )? - RPAREN) - | (LBRACKET (expr)? RBRACKET) - )* - - | ( (LPAREN - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - ( COMMA! )? - RPAREN) - | (LBRACKET (expr)? RBRACKET) - )+ - ) - { ## = #( #[NNonemptyAbstractDeclarator], ## ); } - - ; - - - -unaryExpr - : postfixExpr - | INC^ castExpr - | DEC^ castExpr - | u:unaryOperator castExpr { ## = #( #[NUnaryExpr], ## ); } - - | "sizeof"^ - ( ( LPAREN typeName )=> LPAREN typeName RPAREN - | unaryExpr - ) - | "__alignof"^ - ( ( LPAREN typeName )=> LPAREN typeName RPAREN - | unaryExpr - ) - | gnuAsmExpr - ; - -unaryOperator - : BAND - | STAR - | PLUS - | MINUS - | BNOT //also stands for complex conjugation - | LNOT - | LAND //for label dereference (&&label) - | "__real" - | "__imag" - ; - -gnuAsmExpr - : "asm"^ ("volatile")? - LPAREN stringConst - ( options { warnWhenFollowAmbig = false; }: - COLON (strOptExprPair ( COMMA strOptExprPair)* )? - ( options { warnWhenFollowAmbig = false; }: - COLON (strOptExprPair ( COMMA strOptExprPair)* )? - )? - )? - ( COLON stringConst ( COMMA stringConst)* )? - RPAREN - { ##.setType(NGnuAsmExpr); } - ; - -//GCC requires the PARENs -strOptExprPair - : stringConst ( LPAREN expr RPAREN )? - ; - - -primaryExpr - : ID - | Number - | charConst - | stringConst -// JTC: -// ID should catch the enumerator -// leaving it in gives ambiguous err -// | enumerator - | (LPAREN LCURLY) => LPAREN^ compoundStatement[getAScopeName()] RPAREN - | LPAREN^ expr RPAREN { ##.setType(NExpressionGroup); } - ; - - -{ -// import CToken; - import java.io.*; -// import LineObject; - import antlr.*; -} - -class WLexer extends StdCLexer; -options - { - k = 3; - importVocab = W; - testLiterals = false; - } -tokens { - LITERAL___extension__ = "__extension__"; -} - -{ - public void initialize(String src) - { - setOriginalSource(src); - initialize(); - } - - public void initialize() - { - literals.put(new ANTLRHashString("__alignof__", this), new Integer(LITERAL___alignof)); - literals.put(new ANTLRHashString("__asm", this), new Integer(LITERAL_asm)); - literals.put(new ANTLRHashString("__asm__", this), new Integer(LITERAL_asm)); - literals.put(new ANTLRHashString("__attribute__", this), new Integer(LITERAL___attribute)); - literals.put(new ANTLRHashString("__complex__", this), new Integer(LITERAL___complex)); - literals.put(new ANTLRHashString("__const", this), new Integer(LITERAL_const)); - literals.put(new ANTLRHashString("__const__", this), new Integer(LITERAL_const)); - literals.put(new ANTLRHashString("__imag__", this), new Integer(LITERAL___imag)); - literals.put(new ANTLRHashString("__inline", this), new Integer(LITERAL_inline)); - literals.put(new ANTLRHashString("__inline__", this), new Integer(LITERAL_inline)); - literals.put(new ANTLRHashString("__real__", this), new Integer(LITERAL___real)); - literals.put(new ANTLRHashString("__signed", this), new Integer(LITERAL_signed)); - literals.put(new ANTLRHashString("__signed__", this), new Integer(LITERAL_signed)); - literals.put(new ANTLRHashString("__typeof", this), new Integer(LITERAL_typeof)); - literals.put(new ANTLRHashString("__typeof__", this), new Integer(LITERAL_typeof)); - literals.put(new ANTLRHashString("__volatile", this), new Integer(LITERAL_volatile)); - literals.put(new ANTLRHashString("__volatile__", this), new Integer(LITERAL_volatile)); - } - - - LineObject lineObject = new LineObject(); - String originalSource = ""; - PreprocessorInfoChannel preprocessorInfoChannel = new PreprocessorInfoChannel(); - int tokenNumber = 0; - boolean countingTokens = true; - int deferredLineCount = 0; - - public void setCountingTokens(boolean ct) - { - countingTokens = ct; - if ( countingTokens ) { - tokenNumber = 0; - } - else { - tokenNumber = 1; - } - } - - public void setOriginalSource(String src) - { - originalSource = src; - lineObject.setSource(src); - } - public void setSource(String src) - { - lineObject.setSource(src); - } - - public PreprocessorInfoChannel getPreprocessorInfoChannel() - { - return preprocessorInfoChannel; - } - - public void setPreprocessingDirective(String pre) - { - preprocessorInfoChannel.addLineForTokenNumber( pre, new Integer(tokenNumber) ); - } - - protected Token makeToken(int t) - { - if ( t != Token.SKIP && countingTokens) { - tokenNumber++; - } - CToken tok = (CToken) super.makeToken(t); - tok.setLine(lineObject.line); - tok.setSource(lineObject.source); - tok.setTokenNumber(tokenNumber); - - lineObject.line += deferredLineCount; - deferredLineCount = 0; - return tok; - } - - public void deferredNewline() { - deferredLineCount++; - } - - public void newline() { - lineObject.newline(); - } - - - - - - -} -Whitespace - : ( ( ' ' | '\t' | '\014') - | "\r\n" { newline(); } - | ( '\n' | '\r' ) { newline(); } - ) { _ttype = Token.SKIP; } - ; - - -protected -Escape - : '\\' - ( options{warnWhenFollowAmbig=false;}: - ~('0'..'7' | 'x') - | ('0'..'3') ( options{warnWhenFollowAmbig=false;}: Digit )* - | ('4'..'7') ( options{warnWhenFollowAmbig=false;}: Digit )* - | 'x' ( options{warnWhenFollowAmbig=false;}: Digit | 'a'..'f' | 'A'..'F' )+ - ) - ; - -protected IntSuffix - : 'L' - | 'l' - | 'U' - | 'u' - | 'I' - | 'i' - | 'J' - | 'j' - ; -protected NumberSuffix - : - IntSuffix - | 'F' - | 'f' - ; - -Number - : ( ( Digit )+ ( '.' | 'e' | 'E' ) )=> ( Digit )+ - ( '.' ( Digit )* ( Exponent )? - | Exponent - ) - ( NumberSuffix - )* - - | ( "..." )=> "..." { _ttype = VARARGS; } - - | '.' { _ttype = DOT; } - ( ( Digit )+ ( Exponent )? - { _ttype = Number; } - ( NumberSuffix - )* - )? - - | '0' ( '0'..'7' )* - ( NumberSuffix - )* - - | '1'..'9' ( Digit )* - ( NumberSuffix - )* - - | '0' ( 'x' | 'X' ) ( 'a'..'f' | 'A'..'F' | Digit )+ - ( IntSuffix - )* - ; - -IDMEAT - : - i:ID { - - if ( i.getType() == LITERAL___extension__ ) { - $setType(Token.SKIP); - } - else { - $setType(i.getType()); - } - - } - ; - -protected ID - options - { - testLiterals = true; - } - : ( 'a'..'z' | 'A'..'Z' | '_' | '$') - ( 'a'..'z' | 'A'..'Z' | '_' | '$' | '0'..'9' )* - ; - -WideCharLiteral - : - 'L' CharLiteral - { $setType(CharLiteral); } - ; - - - -WideStringLiteral - : - 'L' StringLiteral - { $setType(StringLiteral); } - ; - -StringLiteral - : - '"' - ( ('\\' ~('\n'))=> Escape - | ( '\r' { newline(); } - | '\n' { - newline(); - } - | '\\' '\n' { - newline(); - } - ) - | ~( '"' | '\r' | '\n' | '\\' ) - )* - '"' - ; - - - - diff --git a/app/preproc/WParser.java b/app/preproc/WParser.java deleted file mode 100644 index 7af46be37..000000000 --- a/app/preproc/WParser.java +++ /dev/null @@ -1,6718 +0,0 @@ -// $ANTLR 2.7.2: "expandedWParser.g" -> "WParser.java"$ - -package processing.app.preproc; - -import java.io.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; - -import antlr.TokenBuffer; -import antlr.TokenStreamException; -import antlr.TokenStreamIOException; -import antlr.ANTLRException; -import antlr.LLkParser; -import antlr.Token; -import antlr.TokenStream; -import antlr.RecognitionException; -import antlr.NoViableAltException; -import antlr.MismatchedTokenException; -import antlr.SemanticException; -import antlr.ParserSharedInputState; -import antlr.collections.impl.BitSet; -import antlr.collections.AST; -import java.util.Hashtable; -import antlr.ASTFactory; -import antlr.ASTPair; -import antlr.collections.impl.ASTArray; - -public class WParser extends antlr.LLkParser implements WTokenTypes - { - - // Suppport C++-style single-line comments? - public static boolean CPPComments = true; - - // access to symbol table - public CSymbolTable symbolTable = new CSymbolTable(); - - // source for names to unnamed scopes - protected int unnamedScopeCounter = 0; - - public boolean isTypedefName(String name) { - boolean returnValue = false; - TNode node = symbolTable.lookupNameInCurrentScope(name); - for (; node != null; node = (TNode) node.getNextSibling() ) { - if(node.getType() == LITERAL_typedef) { - returnValue = true; - break; - } - } - return returnValue; - } - - - public String getAScopeName() { - return "" + (unnamedScopeCounter++); - } - - public void pushScope(String scopeName) { - symbolTable.pushScope(scopeName); - } - - public void popScope() { - symbolTable.popScope(); - } - - int traceDepth = 0; - public void reportError(RecognitionException ex) { - try { - System.err.println("ANTLR Parsing Error: "+ex + " token name:" + tokenNames[LA(1)]); - ex.printStackTrace(System.err); - } - catch (TokenStreamException e) { - System.err.println("ANTLR Parsing Error: "+ex); - ex.printStackTrace(System.err); - } - } - public void reportError(String s) { - System.err.println("ANTLR Parsing Error from String: " + s); - } - public void reportWarning(String s) { - System.err.println("ANTLR Parsing Warning from String: " + s); - } - public void match(int t) throws MismatchedTokenException { - boolean debugging = false; - - if ( debugging ) { - for (int x=0; x0)?" [inputState.guessing "+ inputState.guessing + "]":"")); - - } - - } - try { - if ( LA(1)!=t ) { - if ( debugging ){ - for (int x=0; x "+rname+"; LA(1)==("+ tokenNames[LT(1).getType()] - + ") " + LT(1).getText() + " [inputState.guessing "+ inputState.guessing + "]"); - } - catch (TokenStreamException e) { - } - } - public void traceOut(String rname) { - for (int x=0; x=1 ) { break _loop209; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt209++; - } while (true); - } - externalList_AST = (TNode)currentAST.root; - returnAST = externalList_AST; - } - - public final void asm_expr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode asm_expr_AST = null; - - TNode tmp1_AST = null; - tmp1_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp1_AST); - match(LITERAL_asm); - { - switch ( LA(1)) { - case LITERAL_volatile: - { - TNode tmp2_AST = null; - tmp2_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp2_AST); - match(LITERAL_volatile); - break; - } - case LCURLY: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp3_AST = null; - tmp3_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp3_AST); - match(LCURLY); - expr(); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp4_AST = null; - tmp4_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp4_AST); - match(RCURLY); - { - int _cnt6=0; - _loop6: - do { - if ((LA(1)==SEMI) && (_tokenSet_1.member(LA(2)))) { - TNode tmp5_AST = null; - tmp5_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp5_AST); - match(SEMI); - } - else { - if ( _cnt6>=1 ) { break _loop6; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt6++; - } while (true); - } - asm_expr_AST = (TNode)currentAST.root; - returnAST = asm_expr_AST; - } - - public final void expr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode expr_AST = null; - Token c = null; - TNode c_AST = null; - - assignExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop259: - do { - if ((LA(1)==COMMA) && (_tokenSet_2.member(LA(2)))) { - c = LT(1); - c_AST = (TNode)astFactory.create(c); - astFactory.makeASTRoot(currentAST, c_AST); - match(COMMA); - if ( inputState.guessing==0 ) { - c_AST.setType(NCommaExpr); - } - assignExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop259; - } - - } while (true); - } - expr_AST = (TNode)currentAST.root; - returnAST = expr_AST; - } - - public final void idList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode idList_AST = null; - - TNode tmp6_AST = null; - tmp6_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp6_AST); - match(ID); - { - _loop9: - do { - if ((LA(1)==COMMA) && (LA(2)==ID)) { - TNode tmp7_AST = null; - tmp7_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp7_AST); - match(COMMA); - TNode tmp8_AST = null; - tmp8_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp8_AST); - match(ID); - } - else { - break _loop9; - } - - } while (true); - } - idList_AST = (TNode)currentAST.root; - returnAST = idList_AST; - } - - public final void externalDef() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode externalDef_AST = null; - - switch ( LA(1)) { - case LITERAL_asm: - { - asm_expr(); - astFactory.addASTChild(currentAST, returnAST); - externalDef_AST = (TNode)currentAST.root; - break; - } - case SEMI: - { - TNode tmp9_AST = null; - tmp9_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp9_AST); - match(SEMI); - externalDef_AST = (TNode)currentAST.root; - break; - } - default: - boolean synPredMatched12 = false; - if (((_tokenSet_3.member(LA(1))) && (_tokenSet_4.member(LA(2))))) { - int _m12 = mark(); - synPredMatched12 = true; - inputState.guessing++; - try { - { - if ((LA(1)==LITERAL_typedef) && (true)) { - match(LITERAL_typedef); - } - else if ((_tokenSet_3.member(LA(1))) && (_tokenSet_4.member(LA(2)))) { - declaration(); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - } - catch (RecognitionException pe) { - synPredMatched12 = false; - } - rewind(_m12); - inputState.guessing--; - } - if ( synPredMatched12 ) { - declaration(); - astFactory.addASTChild(currentAST, returnAST); - externalDef_AST = (TNode)currentAST.root; - } - else { - boolean synPredMatched14 = false; - if (((_tokenSet_5.member(LA(1))) && (_tokenSet_6.member(LA(2))))) { - int _m14 = mark(); - synPredMatched14 = true; - inputState.guessing++; - try { - { - functionPrefix(); - } - } - catch (RecognitionException pe) { - synPredMatched14 = false; - } - rewind(_m14); - inputState.guessing--; - } - if ( synPredMatched14 ) { - functionDef(); - astFactory.addASTChild(currentAST, returnAST); - externalDef_AST = (TNode)currentAST.root; - } - else if ((_tokenSet_7.member(LA(1))) && (_tokenSet_8.member(LA(2)))) { - typelessDeclaration(); - astFactory.addASTChild(currentAST, returnAST); - externalDef_AST = (TNode)currentAST.root; - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - }} - returnAST = externalDef_AST; - } - - public final void declaration() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode declaration_AST = null; - TNode ds_AST = null; - AST ds1 = null; - - declSpecifiers(); - ds_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - ds1 = astFactory.dupList(ds_AST); - } - { - switch ( LA(1)) { - case ID: - case STAR: - case LPAREN: - { - initDeclList(ds1); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - int _cnt78=0; - _loop78: - do { - if ((LA(1)==SEMI) && (_tokenSet_9.member(LA(2)))) { - TNode tmp10_AST = null; - tmp10_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp10_AST); - match(SEMI); - } - else { - if ( _cnt78>=1 ) { break _loop78; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt78++; - } while (true); - } - if ( inputState.guessing==0 ) { - declaration_AST = (TNode)currentAST.root; - declaration_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NDeclaration)).add(declaration_AST)); - currentAST.root = declaration_AST; - currentAST.child = declaration_AST!=null &&declaration_AST.getFirstChild()!=null ? - declaration_AST.getFirstChild() : declaration_AST; - currentAST.advanceChildToEnd(); - } - declaration_AST = (TNode)currentAST.root; - returnAST = declaration_AST; - } - - public final void functionPrefix() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode functionPrefix_AST = null; - TNode ds_AST = null; - TNode d_AST = null; - String declName; - - { - boolean synPredMatched18 = false; - if (((_tokenSet_10.member(LA(1))) && (_tokenSet_11.member(LA(2))))) { - int _m18 = mark(); - synPredMatched18 = true; - inputState.guessing++; - try { - { - functionDeclSpecifiers(); - } - } - catch (RecognitionException pe) { - synPredMatched18 = false; - } - rewind(_m18); - inputState.guessing--; - } - if ( synPredMatched18 ) { - functionDeclSpecifiers(); - ds_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_7.member(LA(1))) && (_tokenSet_6.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - declName=declarator(true); - d_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - { - _loop20: - do { - if ((_tokenSet_3.member(LA(1)))) { - declaration(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop20; - } - - } while (true); - } - { - switch ( LA(1)) { - case VARARGS: - { - TNode tmp11_AST = null; - tmp11_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp11_AST); - match(VARARGS); - break; - } - case LCURLY: - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - _loop23: - do { - if ((LA(1)==SEMI)) { - TNode tmp12_AST = null; - tmp12_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp12_AST); - match(SEMI); - } - else { - break _loop23; - } - - } while (true); - } - TNode tmp13_AST = null; - tmp13_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp13_AST); - match(LCURLY); - functionPrefix_AST = (TNode)currentAST.root; - returnAST = functionPrefix_AST; - } - - public final void functionDef() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode functionDef_AST = null; - TNode ds_AST = null; - TNode d_AST = null; - String declName; - - { - boolean synPredMatched241 = false; - if (((_tokenSet_10.member(LA(1))) && (_tokenSet_11.member(LA(2))))) { - int _m241 = mark(); - synPredMatched241 = true; - inputState.guessing++; - try { - { - functionDeclSpecifiers(); - } - } - catch (RecognitionException pe) { - synPredMatched241 = false; - } - rewind(_m241); - inputState.guessing--; - } - if ( synPredMatched241 ) { - functionDeclSpecifiers(); - ds_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_7.member(LA(1))) && (_tokenSet_6.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - declName=declarator(true); - d_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - - AST d2, ds2; - d2 = astFactory.dupList(d_AST); - ds2 = astFactory.dupList(ds_AST); - symbolTable.add(declName, (TNode)astFactory.make( (new ASTArray(3)).add(null).add(ds2).add(d2))); - pushScope(declName); - - } - { - _loop243: - do { - if ((_tokenSet_3.member(LA(1)))) { - declaration(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop243; - } - - } while (true); - } - { - switch ( LA(1)) { - case VARARGS: - { - TNode tmp14_AST = null; - tmp14_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp14_AST); - match(VARARGS); - break; - } - case LCURLY: - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - _loop246: - do { - if ((LA(1)==SEMI)) { - match(SEMI); - } - else { - break _loop246; - } - - } while (true); - } - if ( inputState.guessing==0 ) { - popScope(); - } - compoundStatement(declName); - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - functionDef_AST = (TNode)currentAST.root; - functionDef_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NFunctionDef)).add(functionDef_AST)); - currentAST.root = functionDef_AST; - currentAST.child = functionDef_AST!=null &&functionDef_AST.getFirstChild()!=null ? - functionDef_AST.getFirstChild() : functionDef_AST; - currentAST.advanceChildToEnd(); - } - functionDef_AST = (TNode)currentAST.root; - returnAST = functionDef_AST; - } - - public final void typelessDeclaration() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode typelessDeclaration_AST = null; - AST typeMissing = (TNode)astFactory.create(NTypeMissing); - - initDeclList(typeMissing); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp16_AST = null; - tmp16_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp16_AST); - match(SEMI); - if ( inputState.guessing==0 ) { - typelessDeclaration_AST = (TNode)currentAST.root; - typelessDeclaration_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NTypeMissing)).add(typelessDeclaration_AST)); - currentAST.root = typelessDeclaration_AST; - currentAST.child = typelessDeclaration_AST!=null &&typelessDeclaration_AST.getFirstChild()!=null ? - typelessDeclaration_AST.getFirstChild() : typelessDeclaration_AST; - currentAST.advanceChildToEnd(); - } - typelessDeclaration_AST = (TNode)currentAST.root; - returnAST = typelessDeclaration_AST; - } - - public final void functionDeclSpecifiers() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode functionDeclSpecifiers_AST = null; - int specCount = 0; - - { - int _cnt251=0; - _loop251: - do { - switch ( LA(1)) { - case LITERAL_extern: - case LITERAL_static: - case LITERAL_inline: - { - functionStorageClassSpecifier(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LITERAL_volatile: - case LITERAL_const: - { - typeQualifier(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - default: - boolean synPredMatched250 = false; - if (((_tokenSet_12.member(LA(1))) && (_tokenSet_11.member(LA(2))))) { - int _m250 = mark(); - synPredMatched250 = true; - inputState.guessing++; - try { - { - if ((LA(1)==LITERAL_struct) && (true)) { - match(LITERAL_struct); - } - else if ((LA(1)==LITERAL_union) && (true)) { - match(LITERAL_union); - } - else if ((LA(1)==LITERAL_enum) && (true)) { - match(LITERAL_enum); - } - else if ((_tokenSet_12.member(LA(1))) && (true)) { - typeSpecifier(specCount); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - } - catch (RecognitionException pe) { - synPredMatched250 = false; - } - rewind(_m250); - inputState.guessing--; - } - if ( synPredMatched250 ) { - specCount=typeSpecifier(specCount); - astFactory.addASTChild(currentAST, returnAST); - } - else { - if ( _cnt251>=1 ) { break _loop251; } else {throw new NoViableAltException(LT(1), getFilename());} - } - } - _cnt251++; - } while (true); - } - functionDeclSpecifiers_AST = (TNode)currentAST.root; - returnAST = functionDeclSpecifiers_AST; - } - - public final String declarator( - boolean isFunctionDefinition - ) throws RecognitionException, TokenStreamException { - String declName; - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode declarator_AST = null; - Token id = null; - TNode id_AST = null; - declName = ""; - - { - switch ( LA(1)) { - case STAR: - { - pointerGroup(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case ID: - case LPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case ID: - { - id = LT(1); - id_AST = (TNode)astFactory.create(id); - astFactory.addASTChild(currentAST, id_AST); - match(ID); - if ( inputState.guessing==0 ) { - declName = id.getText(); - } - break; - } - case LPAREN: - { - TNode tmp17_AST = null; - tmp17_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp17_AST); - match(LPAREN); - declName=declarator(false); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp18_AST = null; - tmp18_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp18_AST); - match(RPAREN); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - _loop50: - do { - switch ( LA(1)) { - case LPAREN: - { - declaratorParamaterList(isFunctionDefinition, declName); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LBRACKET: - { - TNode tmp19_AST = null; - tmp19_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp19_AST); - match(LBRACKET); - { - switch ( LA(1)) { - case LITERAL_asm: - case ID: - case STAR: - case LPAREN: - case LAND: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case Number: - case LITERAL___alignof: - case LITERAL___real: - case LITERAL___imag: - { - expr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RBRACKET: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp20_AST = null; - tmp20_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp20_AST); - match(RBRACKET); - break; - } - default: - { - break _loop50; - } - } - } while (true); - } - if ( inputState.guessing==0 ) { - declarator_AST = (TNode)currentAST.root; - declarator_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NDeclarator)).add(declarator_AST)); - currentAST.root = declarator_AST; - currentAST.child = declarator_AST!=null &&declarator_AST.getFirstChild()!=null ? - declarator_AST.getFirstChild() : declarator_AST; - currentAST.advanceChildToEnd(); - } - declarator_AST = (TNode)currentAST.root; - returnAST = declarator_AST; - return declName; - } - - public final void initDeclList( - AST declarationSpecifiers - ) throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode initDeclList_AST = null; - - initDecl(declarationSpecifiers); - astFactory.addASTChild(currentAST, returnAST); - { - _loop115: - do { - if ((LA(1)==COMMA) && (_tokenSet_7.member(LA(2)))) { - match(COMMA); - initDecl(declarationSpecifiers); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop115; - } - - } while (true); - } - { - switch ( LA(1)) { - case COMMA: - { - match(COMMA); - break; - } - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - initDeclList_AST = (TNode)currentAST.root; - returnAST = initDeclList_AST; - } - - public final void initializer() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode initializer_AST = null; - - { - if ((_tokenSet_13.member(LA(1))) && (_tokenSet_14.member(LA(2)))) { - { - { - boolean synPredMatched30 = false; - if (((_tokenSet_15.member(LA(1))) && (_tokenSet_16.member(LA(2))))) { - int _m30 = mark(); - synPredMatched30 = true; - inputState.guessing++; - try { - { - initializerElementLabel(); - } - } - catch (RecognitionException pe) { - synPredMatched30 = false; - } - rewind(_m30); - inputState.guessing--; - } - if ( synPredMatched30 ) { - initializerElementLabel(); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_17.member(LA(1))) && (_tokenSet_18.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - { - switch ( LA(1)) { - case LITERAL_asm: - case ID: - case STAR: - case LPAREN: - case LAND: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case Number: - case LITERAL___alignof: - case LITERAL___real: - case LITERAL___imag: - { - assignExpr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LCURLY: - { - lcurlyInitializer(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState.guessing==0 ) { - initializer_AST = (TNode)currentAST.root; - initializer_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NInitializer)).add(initializer_AST)); - currentAST.root = initializer_AST; - currentAST.child = initializer_AST!=null &&initializer_AST.getFirstChild()!=null ? - initializer_AST.getFirstChild() : initializer_AST; - currentAST.advanceChildToEnd(); - } - } - } - else if ((LA(1)==LCURLY) && (_tokenSet_19.member(LA(2)))) { - lcurlyInitializer(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - initializer_AST = (TNode)currentAST.root; - returnAST = initializer_AST; - } - - public final void initializerElementLabel() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode initializerElementLabel_AST = null; - - { - switch ( LA(1)) { - case LBRACKET: - { - { - TNode tmp23_AST = null; - tmp23_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp23_AST); - match(LBRACKET); - { - boolean synPredMatched37 = false; - if (((_tokenSet_2.member(LA(1))) && (_tokenSet_20.member(LA(2))))) { - int _m37 = mark(); - synPredMatched37 = true; - inputState.guessing++; - try { - { - constExpr(); - match(VARARGS); - } - } - catch (RecognitionException pe) { - synPredMatched37 = false; - } - rewind(_m37); - inputState.guessing--; - } - if ( synPredMatched37 ) { - rangeExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_2.member(LA(1))) && (_tokenSet_21.member(LA(2)))) { - constExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - TNode tmp24_AST = null; - tmp24_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp24_AST); - match(RBRACKET); - { - switch ( LA(1)) { - case ASSIGN: - { - TNode tmp25_AST = null; - tmp25_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp25_AST); - match(ASSIGN); - break; - } - case LITERAL_asm: - case LCURLY: - case ID: - case STAR: - case LPAREN: - case LAND: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case Number: - case LITERAL___alignof: - case LITERAL___real: - case LITERAL___imag: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - } - break; - } - case ID: - { - TNode tmp26_AST = null; - tmp26_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp26_AST); - match(ID); - TNode tmp27_AST = null; - tmp27_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp27_AST); - match(COLON); - break; - } - case DOT: - { - TNode tmp28_AST = null; - tmp28_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp28_AST); - match(DOT); - TNode tmp29_AST = null; - tmp29_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp29_AST); - match(ID); - TNode tmp30_AST = null; - tmp30_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp30_AST); - match(ASSIGN); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState.guessing==0 ) { - initializerElementLabel_AST = (TNode)currentAST.root; - initializerElementLabel_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NInitializerElementLabel)).add(initializerElementLabel_AST)) ; - currentAST.root = initializerElementLabel_AST; - currentAST.child = initializerElementLabel_AST!=null &&initializerElementLabel_AST.getFirstChild()!=null ? - initializerElementLabel_AST.getFirstChild() : initializerElementLabel_AST; - currentAST.advanceChildToEnd(); - } - initializerElementLabel_AST = (TNode)currentAST.root; - returnAST = initializerElementLabel_AST; - } - - public final void assignExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode assignExpr_AST = null; - TNode a_AST = null; - - conditionalExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - switch ( LA(1)) { - case ASSIGN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - { - assignOperator(); - a_AST = (TNode)returnAST; - assignExpr(); - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - assignExpr_AST = (TNode)currentAST.root; - assignExpr_AST = (TNode)astFactory.make( (new ASTArray(2)).add(a_AST).add(assignExpr_AST)); - currentAST.root = assignExpr_AST; - currentAST.child = assignExpr_AST!=null &&assignExpr_AST.getFirstChild()!=null ? - assignExpr_AST.getFirstChild() : assignExpr_AST; - currentAST.advanceChildToEnd(); - } - break; - } - case RCURLY: - case SEMI: - case COMMA: - case COLON: - case RPAREN: - case RBRACKET: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - assignExpr_AST = (TNode)currentAST.root; - returnAST = assignExpr_AST; - } - - public final void lcurlyInitializer() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode lcurlyInitializer_AST = null; - - TNode tmp31_AST = null; - tmp31_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp31_AST); - match(LCURLY); - { - switch ( LA(1)) { - case LITERAL_asm: - case LCURLY: - case ID: - case STAR: - case LPAREN: - case LBRACKET: - case LAND: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case DOT: - case CharLiteral: - case StringLiteral: - case Number: - case LITERAL___alignof: - case LITERAL___real: - case LITERAL___imag: - { - initializerList(); - astFactory.addASTChild(currentAST, returnAST); - { - switch ( LA(1)) { - case COMMA: - { - match(COMMA); - break; - } - case RCURLY: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - break; - } - case RCURLY: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp33_AST = null; - tmp33_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp33_AST); - match(RCURLY); - if ( inputState.guessing==0 ) { - lcurlyInitializer_AST = (TNode)currentAST.root; - lcurlyInitializer_AST.setType( NLcurlyInitializer ); - } - lcurlyInitializer_AST = (TNode)currentAST.root; - returnAST = lcurlyInitializer_AST; - } - - public final void constExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode constExpr_AST = null; - - conditionalExpr(); - astFactory.addASTChild(currentAST, returnAST); - constExpr_AST = (TNode)currentAST.root; - returnAST = constExpr_AST; - } - - public final void rangeExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode rangeExpr_AST = null; - - constExpr(); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp34_AST = null; - tmp34_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp34_AST); - match(VARARGS); - constExpr(); - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - rangeExpr_AST = (TNode)currentAST.root; - rangeExpr_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NRangeExpr)).add(rangeExpr_AST)); - currentAST.root = rangeExpr_AST; - currentAST.child = rangeExpr_AST!=null &&rangeExpr_AST.getFirstChild()!=null ? - rangeExpr_AST.getFirstChild() : rangeExpr_AST; - currentAST.advanceChildToEnd(); - } - rangeExpr_AST = (TNode)currentAST.root; - returnAST = rangeExpr_AST; - } - - public final void initializerList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode initializerList_AST = null; - - initializer(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop44: - do { - if ((LA(1)==COMMA) && (_tokenSet_13.member(LA(2)))) { - match(COMMA); - initializer(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop44; - } - - } while (true); - } - initializerList_AST = (TNode)currentAST.root; - returnAST = initializerList_AST; - } - - public final void pointerGroup() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode pointerGroup_AST = null; - - { - int _cnt233=0; - _loop233: - do { - if ((LA(1)==STAR)) { - TNode tmp36_AST = null; - tmp36_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp36_AST); - match(STAR); - { - _loop232: - do { - if ((LA(1)==LITERAL_volatile||LA(1)==LITERAL_const)) { - typeQualifier(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop232; - } - - } while (true); - } - } - else { - if ( _cnt233>=1 ) { break _loop233; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt233++; - } while (true); - } - if ( inputState.guessing==0 ) { - pointerGroup_AST = (TNode)currentAST.root; - pointerGroup_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NPointerGroup)).add(pointerGroup_AST)); - currentAST.root = pointerGroup_AST; - currentAST.child = pointerGroup_AST!=null &&pointerGroup_AST.getFirstChild()!=null ? - pointerGroup_AST.getFirstChild() : pointerGroup_AST; - currentAST.advanceChildToEnd(); - } - pointerGroup_AST = (TNode)currentAST.root; - returnAST = pointerGroup_AST; - } - - public final void declaratorParamaterList( - boolean isFunctionDefinition, String declName - ) throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode declaratorParamaterList_AST = null; - - TNode tmp37_AST = null; - tmp37_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp37_AST); - match(LPAREN); - if ( inputState.guessing==0 ) { - - if (isFunctionDefinition) { - pushScope(declName); - } - else { - pushScope("!"+declName); - } - - } - { - boolean synPredMatched54 = false; - if (((_tokenSet_3.member(LA(1))) && (_tokenSet_22.member(LA(2))))) { - int _m54 = mark(); - synPredMatched54 = true; - inputState.guessing++; - try { - { - declSpecifiers(); - } - } - catch (RecognitionException pe) { - synPredMatched54 = false; - } - rewind(_m54); - inputState.guessing--; - } - if ( synPredMatched54 ) { - parameterTypeList(); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_23.member(LA(1))) && (_tokenSet_24.member(LA(2)))) { - { - switch ( LA(1)) { - case ID: - { - idList(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case COMMA: - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - if ( inputState.guessing==0 ) { - - popScope(); - - } - { - switch ( LA(1)) { - case COMMA: - { - match(COMMA); - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp39_AST = null; - tmp39_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp39_AST); - match(RPAREN); - if ( inputState.guessing==0 ) { - declaratorParamaterList_AST = (TNode)currentAST.root; - declaratorParamaterList_AST.setType(NParameterTypeList); - } - declaratorParamaterList_AST = (TNode)currentAST.root; - returnAST = declaratorParamaterList_AST; - } - - public final void declSpecifiers() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode declSpecifiers_AST = null; - TNode s_AST = null; - int specCount=0; - - { - int _cnt214=0; - _loop214: - do { - switch ( LA(1)) { - case LITERAL_typedef: - case LITERAL_auto: - case LITERAL_register: - case LITERAL_extern: - case LITERAL_static: - case LITERAL_inline: - { - storageClassSpecifier(); - s_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LITERAL_volatile: - case LITERAL_const: - { - typeQualifier(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - default: - boolean synPredMatched213 = false; - if (((_tokenSet_12.member(LA(1))) && (_tokenSet_22.member(LA(2))))) { - int _m213 = mark(); - synPredMatched213 = true; - inputState.guessing++; - try { - { - if ((LA(1)==LITERAL_struct) && (true)) { - match(LITERAL_struct); - } - else if ((LA(1)==LITERAL_union) && (true)) { - match(LITERAL_union); - } - else if ((LA(1)==LITERAL_enum) && (true)) { - match(LITERAL_enum); - } - else if ((_tokenSet_12.member(LA(1))) && (true)) { - typeSpecifier(specCount); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - } - catch (RecognitionException pe) { - synPredMatched213 = false; - } - rewind(_m213); - inputState.guessing--; - } - if ( synPredMatched213 ) { - specCount=typeSpecifier(specCount); - astFactory.addASTChild(currentAST, returnAST); - } - else { - if ( _cnt214>=1 ) { break _loop214; } else {throw new NoViableAltException(LT(1), getFilename());} - } - } - _cnt214++; - } while (true); - } - declSpecifiers_AST = (TNode)currentAST.root; - returnAST = declSpecifiers_AST; - } - - public final void parameterTypeList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode parameterTypeList_AST = null; - - parameterDeclaration(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop60: - do { - if ((LA(1)==SEMI||LA(1)==COMMA) && (_tokenSet_3.member(LA(2)))) { - { - switch ( LA(1)) { - case COMMA: - { - TNode tmp40_AST = null; - tmp40_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp40_AST); - match(COMMA); - break; - } - case SEMI: - { - TNode tmp41_AST = null; - tmp41_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp41_AST); - match(SEMI); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - parameterDeclaration(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop60; - } - - } while (true); - } - { - if ((LA(1)==SEMI||LA(1)==COMMA) && (LA(2)==VARARGS)) { - { - switch ( LA(1)) { - case COMMA: - { - TNode tmp42_AST = null; - tmp42_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp42_AST); - match(COMMA); - break; - } - case SEMI: - { - TNode tmp43_AST = null; - tmp43_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp43_AST); - match(SEMI); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp44_AST = null; - tmp44_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp44_AST); - match(VARARGS); - } - else if ((LA(1)==COMMA||LA(1)==RPAREN) && (_tokenSet_24.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - parameterTypeList_AST = (TNode)currentAST.root; - returnAST = parameterTypeList_AST; - } - - public final void parameterDeclaration() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode parameterDeclaration_AST = null; - TNode ds_AST = null; - TNode d_AST = null; - String declName; - - declSpecifiers(); - ds_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - { - boolean synPredMatched237 = false; - if (((_tokenSet_7.member(LA(1))) && (_tokenSet_25.member(LA(2))))) { - int _m237 = mark(); - synPredMatched237 = true; - inputState.guessing++; - try { - { - declarator(false); - } - } - catch (RecognitionException pe) { - synPredMatched237 = false; - } - rewind(_m237); - inputState.guessing--; - } - if ( synPredMatched237 ) { - declName=declarator(false); - d_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - - AST d2, ds2; - d2 = astFactory.dupList(d_AST); - ds2 = astFactory.dupList(ds_AST); - symbolTable.add(declName, (TNode)astFactory.make( (new ASTArray(3)).add(null).add(ds2).add(d2))); - - } - } - else if ((_tokenSet_26.member(LA(1))) && (_tokenSet_27.member(LA(2)))) { - nonemptyAbstractDeclarator(); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_28.member(LA(1)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - if ( inputState.guessing==0 ) { - parameterDeclaration_AST = (TNode)currentAST.root; - - parameterDeclaration_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NParameterDeclaration)).add(parameterDeclaration_AST)); - - currentAST.root = parameterDeclaration_AST; - currentAST.child = parameterDeclaration_AST!=null &¶meterDeclaration_AST.getFirstChild()!=null ? - parameterDeclaration_AST.getFirstChild() : parameterDeclaration_AST; - currentAST.advanceChildToEnd(); - } - parameterDeclaration_AST = (TNode)currentAST.root; - returnAST = parameterDeclaration_AST; - } - - public final void declarationList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode declarationList_AST = null; - - { - int _cnt67=0; - _loop67: - do { - if ((LA(1)==LITERAL___label__) && (LA(2)==ID)) { - localLabelDeclaration(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - boolean synPredMatched66 = false; - if (((_tokenSet_3.member(LA(1))) && (_tokenSet_4.member(LA(2))))) { - int _m66 = mark(); - synPredMatched66 = true; - inputState.guessing++; - try { - { - declarationPredictor(); - } - } - catch (RecognitionException pe) { - synPredMatched66 = false; - } - rewind(_m66); - inputState.guessing--; - } - if ( synPredMatched66 ) { - declaration(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - if ( _cnt67>=1 ) { break _loop67; } else {throw new NoViableAltException(LT(1), getFilename());} - } - } - _cnt67++; - } while (true); - } - declarationList_AST = (TNode)currentAST.root; - returnAST = declarationList_AST; - } - - public final void localLabelDeclaration() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode localLabelDeclaration_AST = null; - - { - TNode tmp45_AST = null; - tmp45_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp45_AST); - match(LITERAL___label__); - TNode tmp46_AST = null; - tmp46_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp46_AST); - match(ID); - { - _loop71: - do { - if ((LA(1)==COMMA) && (LA(2)==ID)) { - match(COMMA); - TNode tmp48_AST = null; - tmp48_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp48_AST); - match(ID); - } - else { - break _loop71; - } - - } while (true); - } - { - switch ( LA(1)) { - case COMMA: - { - match(COMMA); - break; - } - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - int _cnt74=0; - _loop74: - do { - if ((LA(1)==SEMI) && (_tokenSet_29.member(LA(2)))) { - match(SEMI); - } - else { - if ( _cnt74>=1 ) { break _loop74; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt74++; - } while (true); - } - } - localLabelDeclaration_AST = (TNode)currentAST.root; - returnAST = localLabelDeclaration_AST; - } - - public final void declarationPredictor() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode declarationPredictor_AST = null; - - { - if ((LA(1)==LITERAL_typedef) && (LA(2)==EOF)) { - TNode tmp51_AST = null; - tmp51_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp51_AST); - match(LITERAL_typedef); - } - else if ((_tokenSet_3.member(LA(1))) && (_tokenSet_4.member(LA(2)))) { - declaration(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - declarationPredictor_AST = (TNode)currentAST.root; - returnAST = declarationPredictor_AST; - } - - public final void functionStorageClassSpecifier() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode functionStorageClassSpecifier_AST = null; - - switch ( LA(1)) { - case LITERAL_extern: - { - TNode tmp52_AST = null; - tmp52_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp52_AST); - match(LITERAL_extern); - functionStorageClassSpecifier_AST = (TNode)currentAST.root; - break; - } - case LITERAL_static: - { - TNode tmp53_AST = null; - tmp53_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp53_AST); - match(LITERAL_static); - functionStorageClassSpecifier_AST = (TNode)currentAST.root; - break; - } - case LITERAL_inline: - { - TNode tmp54_AST = null; - tmp54_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp54_AST); - match(LITERAL_inline); - functionStorageClassSpecifier_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - returnAST = functionStorageClassSpecifier_AST; - } - - public final int typeSpecifier( - int specCount - ) throws RecognitionException, TokenStreamException { - int retSpecCount; - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode typeSpecifier_AST = null; - retSpecCount = specCount + 1; - - { - switch ( LA(1)) { - case LITERAL_void: - { - TNode tmp55_AST = null; - tmp55_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp55_AST); - match(LITERAL_void); - break; - } - case LITERAL_char: - { - TNode tmp56_AST = null; - tmp56_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp56_AST); - match(LITERAL_char); - break; - } - case LITERAL_short: - { - TNode tmp57_AST = null; - tmp57_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp57_AST); - match(LITERAL_short); - break; - } - case LITERAL_int: - { - TNode tmp58_AST = null; - tmp58_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp58_AST); - match(LITERAL_int); - break; - } - case LITERAL_long: - { - TNode tmp59_AST = null; - tmp59_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp59_AST); - match(LITERAL_long); - break; - } - case LITERAL_float: - { - TNode tmp60_AST = null; - tmp60_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp60_AST); - match(LITERAL_float); - break; - } - case LITERAL_double: - { - TNode tmp61_AST = null; - tmp61_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp61_AST); - match(LITERAL_double); - break; - } - case LITERAL_signed: - { - TNode tmp62_AST = null; - tmp62_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp62_AST); - match(LITERAL_signed); - break; - } - case LITERAL_unsigned: - { - TNode tmp63_AST = null; - tmp63_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp63_AST); - match(LITERAL_unsigned); - break; - } - case LITERAL_byte: - { - TNode tmp64_AST = null; - tmp64_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp64_AST); - match(LITERAL_byte); - break; - } - case LITERAL_boolean: - { - TNode tmp65_AST = null; - tmp65_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp65_AST); - match(LITERAL_boolean); - break; - } - case LITERAL_Servo: - { - TNode tmp66_AST = null; - tmp66_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp66_AST); - match(LITERAL_Servo); - break; - } - case LITERAL_Wire: - { - TNode tmp67_AST = null; - tmp67_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp67_AST); - match(LITERAL_Wire); - break; - } - case LITERAL_struct: - case LITERAL_union: - { - structOrUnionSpecifier(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop83: - do { - if ((LA(1)==LITERAL_asm||LA(1)==LITERAL___attribute) && (LA(2)==LPAREN)) { - attributeDecl(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop83; - } - - } while (true); - } - break; - } - case LITERAL_enum: - { - enumSpecifier(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LITERAL_typeof: - { - TNode tmp68_AST = null; - tmp68_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp68_AST); - match(LITERAL_typeof); - TNode tmp69_AST = null; - tmp69_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp69_AST); - match(LPAREN); - { - boolean synPredMatched86 = false; - if (((_tokenSet_30.member(LA(1))) && (_tokenSet_31.member(LA(2))))) { - int _m86 = mark(); - synPredMatched86 = true; - inputState.guessing++; - try { - { - typeName(); - } - } - catch (RecognitionException pe) { - synPredMatched86 = false; - } - rewind(_m86); - inputState.guessing--; - } - if ( synPredMatched86 ) { - typeName(); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_2.member(LA(1))) && (_tokenSet_32.member(LA(2)))) { - expr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - TNode tmp70_AST = null; - tmp70_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp70_AST); - match(RPAREN); - break; - } - case LITERAL___complex: - { - TNode tmp71_AST = null; - tmp71_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp71_AST); - match(LITERAL___complex); - break; - } - default: - if (((LA(1)==ID))&&( specCount==0 )) { - typedefName(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - typeSpecifier_AST = (TNode)currentAST.root; - returnAST = typeSpecifier_AST; - return retSpecCount; - } - - public final void structOrUnionSpecifier() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode structOrUnionSpecifier_AST = null; - TNode sou_AST = null; - Token i = null; - TNode i_AST = null; - Token l = null; - TNode l_AST = null; - Token l1 = null; - TNode l1_AST = null; - String scopeName; - - structOrUnion(); - sou_AST = (TNode)returnAST; - { - boolean synPredMatched90 = false; - if (((LA(1)==ID) && (LA(2)==LCURLY))) { - int _m90 = mark(); - synPredMatched90 = true; - inputState.guessing++; - try { - { - match(ID); - match(LCURLY); - } - } - catch (RecognitionException pe) { - synPredMatched90 = false; - } - rewind(_m90); - inputState.guessing--; - } - if ( synPredMatched90 ) { - i = LT(1); - i_AST = (TNode)astFactory.create(i); - astFactory.addASTChild(currentAST, i_AST); - match(ID); - l = LT(1); - l_AST = (TNode)astFactory.create(l); - astFactory.addASTChild(currentAST, l_AST); - match(LCURLY); - if ( inputState.guessing==0 ) { - - scopeName = sou_AST.getText() + " " + i_AST.getText(); - l_AST.setText(scopeName); - pushScope(scopeName); - - } - { - switch ( LA(1)) { - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case ID: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - structDeclarationList(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RCURLY: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState.guessing==0 ) { - popScope(); - } - TNode tmp72_AST = null; - tmp72_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp72_AST); - match(RCURLY); - } - else if ((LA(1)==LCURLY)) { - l1 = LT(1); - l1_AST = (TNode)astFactory.create(l1); - astFactory.addASTChild(currentAST, l1_AST); - match(LCURLY); - if ( inputState.guessing==0 ) { - - scopeName = getAScopeName(); - l1_AST.setText(scopeName); - pushScope(scopeName); - - } - { - switch ( LA(1)) { - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case ID: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - structDeclarationList(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RCURLY: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState.guessing==0 ) { - popScope(); - } - TNode tmp73_AST = null; - tmp73_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp73_AST); - match(RCURLY); - } - else if ((LA(1)==ID) && (_tokenSet_33.member(LA(2)))) { - TNode tmp74_AST = null; - tmp74_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp74_AST); - match(ID); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - if ( inputState.guessing==0 ) { - structOrUnionSpecifier_AST = (TNode)currentAST.root; - - structOrUnionSpecifier_AST = (TNode)astFactory.make( (new ASTArray(2)).add(sou_AST).add(structOrUnionSpecifier_AST)); - - currentAST.root = structOrUnionSpecifier_AST; - currentAST.child = structOrUnionSpecifier_AST!=null &&structOrUnionSpecifier_AST.getFirstChild()!=null ? - structOrUnionSpecifier_AST.getFirstChild() : structOrUnionSpecifier_AST; - currentAST.advanceChildToEnd(); - } - structOrUnionSpecifier_AST = (TNode)currentAST.root; - returnAST = structOrUnionSpecifier_AST; - } - - public final void attributeDecl() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode attributeDecl_AST = null; - - switch ( LA(1)) { - case LITERAL___attribute: - { - TNode tmp75_AST = null; - tmp75_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp75_AST); - match(LITERAL___attribute); - TNode tmp76_AST = null; - tmp76_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp76_AST); - match(LPAREN); - TNode tmp77_AST = null; - tmp77_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp77_AST); - match(LPAREN); - attributeList(); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp78_AST = null; - tmp78_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp78_AST); - match(RPAREN); - TNode tmp79_AST = null; - tmp79_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp79_AST); - match(RPAREN); - attributeDecl_AST = (TNode)currentAST.root; - break; - } - case LITERAL_asm: - { - TNode tmp80_AST = null; - tmp80_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp80_AST); - match(LITERAL_asm); - TNode tmp81_AST = null; - tmp81_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp81_AST); - match(LPAREN); - stringConst(); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp82_AST = null; - tmp82_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp82_AST); - match(RPAREN); - if ( inputState.guessing==0 ) { - attributeDecl_AST = (TNode)currentAST.root; - attributeDecl_AST.setType( NAsmAttribute ); - } - attributeDecl_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - returnAST = attributeDecl_AST; - } - - public final void enumSpecifier() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode enumSpecifier_AST = null; - Token i = null; - TNode i_AST = null; - - TNode tmp83_AST = null; - tmp83_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp83_AST); - match(LITERAL_enum); - { - boolean synPredMatched108 = false; - if (((LA(1)==ID) && (LA(2)==LCURLY))) { - int _m108 = mark(); - synPredMatched108 = true; - inputState.guessing++; - try { - { - match(ID); - match(LCURLY); - } - } - catch (RecognitionException pe) { - synPredMatched108 = false; - } - rewind(_m108); - inputState.guessing--; - } - if ( synPredMatched108 ) { - i = LT(1); - i_AST = (TNode)astFactory.create(i); - astFactory.addASTChild(currentAST, i_AST); - match(ID); - TNode tmp84_AST = null; - tmp84_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp84_AST); - match(LCURLY); - enumList(i.getText()); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp85_AST = null; - tmp85_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp85_AST); - match(RCURLY); - } - else if ((LA(1)==LCURLY)) { - TNode tmp86_AST = null; - tmp86_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp86_AST); - match(LCURLY); - enumList("anonymous"); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp87_AST = null; - tmp87_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp87_AST); - match(RCURLY); - } - else if ((LA(1)==ID) && (_tokenSet_33.member(LA(2)))) { - TNode tmp88_AST = null; - tmp88_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp88_AST); - match(ID); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - enumSpecifier_AST = (TNode)currentAST.root; - returnAST = enumSpecifier_AST; - } - - public final void typedefName() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode typedefName_AST = null; - Token i = null; - TNode i_AST = null; - - if (!( isTypedefName ( LT(1).getText() ) )) - throw new SemanticException(" isTypedefName ( LT(1).getText() ) "); - i = LT(1); - i_AST = (TNode)astFactory.create(i); - astFactory.addASTChild(currentAST, i_AST); - match(ID); - if ( inputState.guessing==0 ) { - typedefName_AST = (TNode)currentAST.root; - typedefName_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NTypedefName)).add(i_AST)); - currentAST.root = typedefName_AST; - currentAST.child = typedefName_AST!=null &&typedefName_AST.getFirstChild()!=null ? - typedefName_AST.getFirstChild() : typedefName_AST; - currentAST.advanceChildToEnd(); - } - typedefName_AST = (TNode)currentAST.root; - returnAST = typedefName_AST; - } - - public final void typeName() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode typeName_AST = null; - - specifierQualifierList(); - astFactory.addASTChild(currentAST, returnAST); - { - switch ( LA(1)) { - case STAR: - case LPAREN: - case LBRACKET: - { - nonemptyAbstractDeclarator(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - typeName_AST = (TNode)currentAST.root; - returnAST = typeName_AST; - } - - public final void structOrUnion() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode structOrUnion_AST = null; - - switch ( LA(1)) { - case LITERAL_struct: - { - TNode tmp89_AST = null; - tmp89_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp89_AST); - match(LITERAL_struct); - structOrUnion_AST = (TNode)currentAST.root; - break; - } - case LITERAL_union: - { - TNode tmp90_AST = null; - tmp90_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp90_AST); - match(LITERAL_union); - structOrUnion_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - returnAST = structOrUnion_AST; - } - - public final void structDeclarationList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode structDeclarationList_AST = null; - - { - int _cnt221=0; - _loop221: - do { - if ((_tokenSet_30.member(LA(1)))) { - structDeclaration(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - if ( _cnt221>=1 ) { break _loop221; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt221++; - } while (true); - } - structDeclarationList_AST = (TNode)currentAST.root; - returnAST = structDeclarationList_AST; - } - - public final void structDeclaration() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode structDeclaration_AST = null; - - specifierQualifierList(); - astFactory.addASTChild(currentAST, returnAST); - structDeclaratorList(); - astFactory.addASTChild(currentAST, returnAST); - { - switch ( LA(1)) { - case COMMA: - { - match(COMMA); - break; - } - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - int _cnt96=0; - _loop96: - do { - if ((LA(1)==SEMI)) { - match(SEMI); - } - else { - if ( _cnt96>=1 ) { break _loop96; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt96++; - } while (true); - } - structDeclaration_AST = (TNode)currentAST.root; - returnAST = structDeclaration_AST; - } - - public final void specifierQualifierList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode specifierQualifierList_AST = null; - int specCount = 0; - - { - int _cnt226=0; - _loop226: - do { - boolean synPredMatched225 = false; - if (((_tokenSet_12.member(LA(1))) && (_tokenSet_34.member(LA(2))))) { - int _m225 = mark(); - synPredMatched225 = true; - inputState.guessing++; - try { - { - if ((LA(1)==LITERAL_struct) && (true)) { - match(LITERAL_struct); - } - else if ((LA(1)==LITERAL_union) && (true)) { - match(LITERAL_union); - } - else if ((LA(1)==LITERAL_enum) && (true)) { - match(LITERAL_enum); - } - else if ((_tokenSet_12.member(LA(1))) && (true)) { - typeSpecifier(specCount); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - } - catch (RecognitionException pe) { - synPredMatched225 = false; - } - rewind(_m225); - inputState.guessing--; - } - if ( synPredMatched225 ) { - specCount=typeSpecifier(specCount); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((LA(1)==LITERAL_volatile||LA(1)==LITERAL_const)) { - typeQualifier(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - if ( _cnt226>=1 ) { break _loop226; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt226++; - } while (true); - } - specifierQualifierList_AST = (TNode)currentAST.root; - returnAST = specifierQualifierList_AST; - } - - public final void structDeclaratorList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode structDeclaratorList_AST = null; - - structDeclarator(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop99: - do { - if ((LA(1)==COMMA) && (_tokenSet_35.member(LA(2)))) { - match(COMMA); - structDeclarator(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop99; - } - - } while (true); - } - structDeclaratorList_AST = (TNode)currentAST.root; - returnAST = structDeclaratorList_AST; - } - - public final void structDeclarator() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode structDeclarator_AST = null; - - { - switch ( LA(1)) { - case ID: - case STAR: - case LPAREN: - { - declarator(false); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LITERAL_asm: - case SEMI: - case COMMA: - case COLON: - case LITERAL___attribute: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case COLON: - { - TNode tmp94_AST = null; - tmp94_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp94_AST); - match(COLON); - constExpr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LITERAL_asm: - case SEMI: - case COMMA: - case LITERAL___attribute: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - _loop104: - do { - if ((LA(1)==LITERAL_asm||LA(1)==LITERAL___attribute)) { - attributeDecl(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop104; - } - - } while (true); - } - if ( inputState.guessing==0 ) { - structDeclarator_AST = (TNode)currentAST.root; - structDeclarator_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NStructDeclarator)).add(structDeclarator_AST)); - currentAST.root = structDeclarator_AST; - currentAST.child = structDeclarator_AST!=null &&structDeclarator_AST.getFirstChild()!=null ? - structDeclarator_AST.getFirstChild() : structDeclarator_AST; - currentAST.advanceChildToEnd(); - } - structDeclarator_AST = (TNode)currentAST.root; - returnAST = structDeclarator_AST; - } - - public final void enumList( - String enumName - ) throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode enumList_AST = null; - - enumerator(enumName); - astFactory.addASTChild(currentAST, returnAST); - { - _loop111: - do { - if ((LA(1)==COMMA) && (LA(2)==ID)) { - match(COMMA); - enumerator(enumName); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop111; - } - - } while (true); - } - { - switch ( LA(1)) { - case COMMA: - { - match(COMMA); - break; - } - case RCURLY: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - enumList_AST = (TNode)currentAST.root; - returnAST = enumList_AST; - } - - public final void enumerator( - String enumName - ) throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode enumerator_AST = null; - Token i = null; - TNode i_AST = null; - - i = LT(1); - i_AST = (TNode)astFactory.create(i); - astFactory.addASTChild(currentAST, i_AST); - match(ID); - if ( inputState.guessing==0 ) { - symbolTable.add( i.getText(), - (TNode)astFactory.make( (new ASTArray(3)).add(null).add((TNode)astFactory.create(LITERAL_enum,"enum")).add((TNode)astFactory.create(ID,enumName))) - ); - - } - { - switch ( LA(1)) { - case ASSIGN: - { - TNode tmp97_AST = null; - tmp97_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp97_AST); - match(ASSIGN); - constExpr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RCURLY: - case COMMA: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - enumerator_AST = (TNode)currentAST.root; - returnAST = enumerator_AST; - } - - public final void initDecl( - AST declarationSpecifiers - ) throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode initDecl_AST = null; - TNode d_AST = null; - String declName = ""; - - declName=declarator(false); - d_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - AST ds1, d1; - ds1 = astFactory.dupList(declarationSpecifiers); - d1 = astFactory.dupList(d_AST); - symbolTable.add(declName, (TNode)astFactory.make( (new ASTArray(3)).add(null).add(ds1).add(d1)) ); - - } - { - _loop119: - do { - if ((LA(1)==LITERAL_asm||LA(1)==LITERAL___attribute)) { - attributeDecl(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop119; - } - - } while (true); - } - { - switch ( LA(1)) { - case ASSIGN: - { - TNode tmp98_AST = null; - tmp98_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp98_AST); - match(ASSIGN); - initializer(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case COLON: - { - TNode tmp99_AST = null; - tmp99_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp99_AST); - match(COLON); - expr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case SEMI: - case COMMA: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState.guessing==0 ) { - initDecl_AST = (TNode)currentAST.root; - initDecl_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NInitDecl)).add(initDecl_AST)); - currentAST.root = initDecl_AST; - currentAST.child = initDecl_AST!=null &&initDecl_AST.getFirstChild()!=null ? - initDecl_AST.getFirstChild() : initDecl_AST; - currentAST.advanceChildToEnd(); - } - initDecl_AST = (TNode)currentAST.root; - returnAST = initDecl_AST; - } - - public final void attributeList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode attributeList_AST = null; - - attribute(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop124: - do { - if ((LA(1)==COMMA) && ((LA(2) >= LITERAL_typedef && LA(2) <= LITERAL___imag))) { - TNode tmp100_AST = null; - tmp100_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp100_AST); - match(COMMA); - attribute(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop124; - } - - } while (true); - } - { - switch ( LA(1)) { - case COMMA: - { - TNode tmp101_AST = null; - tmp101_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp101_AST); - match(COMMA); - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - attributeList_AST = (TNode)currentAST.root; - returnAST = attributeList_AST; - } - - protected final void stringConst() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode stringConst_AST = null; - - { - int _cnt314=0; - _loop314: - do { - if ((LA(1)==StringLiteral)) { - TNode tmp102_AST = null; - tmp102_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp102_AST); - match(StringLiteral); - } - else { - if ( _cnt314>=1 ) { break _loop314; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt314++; - } while (true); - } - if ( inputState.guessing==0 ) { - stringConst_AST = (TNode)currentAST.root; - stringConst_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NStringSeq)).add(stringConst_AST)); - currentAST.root = stringConst_AST; - currentAST.child = stringConst_AST!=null &&stringConst_AST.getFirstChild()!=null ? - stringConst_AST.getFirstChild() : stringConst_AST; - currentAST.advanceChildToEnd(); - } - stringConst_AST = (TNode)currentAST.root; - returnAST = stringConst_AST; - } - - public final void attribute() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode attribute_AST = null; - - { - _loop129: - do { - if ((_tokenSet_36.member(LA(1)))) { - { - TNode tmp103_AST = null; - tmp103_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp103_AST); - match(_tokenSet_36); - } - } - else if ((LA(1)==LPAREN)) { - TNode tmp104_AST = null; - tmp104_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp104_AST); - match(LPAREN); - attributeList(); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp105_AST = null; - tmp105_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp105_AST); - match(RPAREN); - } - else { - break _loop129; - } - - } while (true); - } - attribute_AST = (TNode)currentAST.root; - returnAST = attribute_AST; - } - - public final void compoundStatement( - String scopeName - ) throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode compoundStatement_AST = null; - - TNode tmp106_AST = null; - tmp106_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp106_AST); - match(LCURLY); - if ( inputState.guessing==0 ) { - - pushScope(scopeName); - - } - { - _loop136: - do { - boolean synPredMatched133 = false; - if (((_tokenSet_37.member(LA(1))) && (_tokenSet_4.member(LA(2))))) { - int _m133 = mark(); - synPredMatched133 = true; - inputState.guessing++; - try { - { - if ((LA(1)==LITERAL_typedef) && (true)) { - match(LITERAL_typedef); - } - else if ((LA(1)==LITERAL___label__)) { - match(LITERAL___label__); - } - else if ((_tokenSet_3.member(LA(1))) && (_tokenSet_4.member(LA(2)))) { - declaration(); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - } - catch (RecognitionException pe) { - synPredMatched133 = false; - } - rewind(_m133); - inputState.guessing--; - } - if ( synPredMatched133 ) { - declarationList(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - boolean synPredMatched135 = false; - if (((_tokenSet_38.member(LA(1))) && (_tokenSet_39.member(LA(2))))) { - int _m135 = mark(); - synPredMatched135 = true; - inputState.guessing++; - try { - { - nestedFunctionDef(); - } - } - catch (RecognitionException pe) { - synPredMatched135 = false; - } - rewind(_m135); - inputState.guessing--; - } - if ( synPredMatched135 ) { - nestedFunctionDef(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop136; - } - } - } while (true); - } - { - switch ( LA(1)) { - case LITERAL_asm: - case LCURLY: - case SEMI: - case ID: - case STAR: - case LPAREN: - case LITERAL_while: - case LITERAL_do: - case LITERAL_for: - case LITERAL_goto: - case LITERAL_continue: - case LITERAL_break: - case LITERAL_return: - case LITERAL_case: - case LITERAL_default: - case LITERAL_if: - case LITERAL_switch: - case LAND: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case Number: - case LITERAL___alignof: - case LITERAL___real: - case LITERAL___imag: - { - statementList(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RCURLY: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState.guessing==0 ) { - popScope(); - } - TNode tmp107_AST = null; - tmp107_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp107_AST); - match(RCURLY); - if ( inputState.guessing==0 ) { - compoundStatement_AST = (TNode)currentAST.root; - compoundStatement_AST.setType( NCompoundStatement ); compoundStatement_AST.setAttribute( "scopeName", scopeName ); - } - compoundStatement_AST = (TNode)currentAST.root; - returnAST = compoundStatement_AST; - } - - public final void nestedFunctionDef() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode nestedFunctionDef_AST = null; - TNode ds_AST = null; - TNode d_AST = null; - String declName; - - { - switch ( LA(1)) { - case LITERAL_auto: - { - TNode tmp108_AST = null; - tmp108_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp108_AST); - match(LITERAL_auto); - break; - } - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_extern: - case LITERAL_static: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case ID: - case STAR: - case LPAREN: - case LITERAL_inline: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - boolean synPredMatched142 = false; - if (((_tokenSet_10.member(LA(1))) && (_tokenSet_11.member(LA(2))))) { - int _m142 = mark(); - synPredMatched142 = true; - inputState.guessing++; - try { - { - functionDeclSpecifiers(); - } - } - catch (RecognitionException pe) { - synPredMatched142 = false; - } - rewind(_m142); - inputState.guessing--; - } - if ( synPredMatched142 ) { - functionDeclSpecifiers(); - ds_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_7.member(LA(1))) && (_tokenSet_39.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - declName=declarator(false); - d_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - - AST d2, ds2; - d2 = astFactory.dupList(d_AST); - ds2 = astFactory.dupList(ds_AST); - symbolTable.add(declName, (TNode)astFactory.make( (new ASTArray(3)).add(null).add(ds2).add(d2))); - pushScope(declName); - - } - { - _loop144: - do { - if ((_tokenSet_3.member(LA(1)))) { - declaration(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop144; - } - - } while (true); - } - if ( inputState.guessing==0 ) { - popScope(); - } - compoundStatement(declName); - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - nestedFunctionDef_AST = (TNode)currentAST.root; - nestedFunctionDef_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NFunctionDef)).add(nestedFunctionDef_AST)); - currentAST.root = nestedFunctionDef_AST; - currentAST.child = nestedFunctionDef_AST!=null &&nestedFunctionDef_AST.getFirstChild()!=null ? - nestedFunctionDef_AST.getFirstChild() : nestedFunctionDef_AST; - currentAST.advanceChildToEnd(); - } - nestedFunctionDef_AST = (TNode)currentAST.root; - returnAST = nestedFunctionDef_AST; - } - - public final void statementList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode statementList_AST = null; - - { - int _cnt256=0; - _loop256: - do { - if ((_tokenSet_40.member(LA(1)))) { - statement(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - if ( _cnt256>=1 ) { break _loop256; } else {throw new NoViableAltException(LT(1), getFilename());} - } - - _cnt256++; - } while (true); - } - statementList_AST = (TNode)currentAST.root; - returnAST = statementList_AST; - } - - public final void statement() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode statement_AST = null; - TNode e1_AST = null; - TNode e2_AST = null; - TNode e3_AST = null; - TNode s_AST = null; - - switch ( LA(1)) { - case SEMI: - { - TNode tmp109_AST = null; - tmp109_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp109_AST); - match(SEMI); - statement_AST = (TNode)currentAST.root; - break; - } - case LCURLY: - { - compoundStatement(getAScopeName()); - astFactory.addASTChild(currentAST, returnAST); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_while: - { - TNode tmp110_AST = null; - tmp110_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp110_AST); - match(LITERAL_while); - match(LPAREN); - expr(); - astFactory.addASTChild(currentAST, returnAST); - match(RPAREN); - statement(); - astFactory.addASTChild(currentAST, returnAST); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_do: - { - TNode tmp113_AST = null; - tmp113_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp113_AST); - match(LITERAL_do); - statement(); - astFactory.addASTChild(currentAST, returnAST); - match(LITERAL_while); - match(LPAREN); - expr(); - astFactory.addASTChild(currentAST, returnAST); - match(RPAREN); - match(SEMI); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_for: - { - match(LITERAL_for); - TNode tmp119_AST = null; - tmp119_AST = (TNode)astFactory.create(LT(1)); - match(LPAREN); - { - switch ( LA(1)) { - case LITERAL_asm: - case ID: - case STAR: - case LPAREN: - case LAND: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case Number: - case LITERAL___alignof: - case LITERAL___real: - case LITERAL___imag: - { - expr(); - e1_AST = (TNode)returnAST; - break; - } - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp120_AST = null; - tmp120_AST = (TNode)astFactory.create(LT(1)); - match(SEMI); - { - switch ( LA(1)) { - case LITERAL_asm: - case ID: - case STAR: - case LPAREN: - case LAND: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case Number: - case LITERAL___alignof: - case LITERAL___real: - case LITERAL___imag: - { - expr(); - e2_AST = (TNode)returnAST; - break; - } - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp121_AST = null; - tmp121_AST = (TNode)astFactory.create(LT(1)); - match(SEMI); - { - switch ( LA(1)) { - case LITERAL_asm: - case ID: - case STAR: - case LPAREN: - case LAND: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case Number: - case LITERAL___alignof: - case LITERAL___real: - case LITERAL___imag: - { - expr(); - e3_AST = (TNode)returnAST; - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp122_AST = null; - tmp122_AST = (TNode)astFactory.create(LT(1)); - match(RPAREN); - statement(); - s_AST = (TNode)returnAST; - if ( inputState.guessing==0 ) { - statement_AST = (TNode)currentAST.root; - - if ( e1_AST == null) { e1_AST = (TNode)astFactory.create(NEmptyExpression); } - if ( e2_AST == null) { e2_AST = (TNode)astFactory.create(NEmptyExpression); } - if ( e3_AST == null) { e3_AST = (TNode)astFactory.create(NEmptyExpression); } - statement_AST = (TNode)astFactory.make( (new ASTArray(5)).add((TNode)astFactory.create(LITERAL_for,"for")).add(e1_AST).add(e2_AST).add(e3_AST).add(s_AST)); - - currentAST.root = statement_AST; - currentAST.child = statement_AST!=null &&statement_AST.getFirstChild()!=null ? - statement_AST.getFirstChild() : statement_AST; - currentAST.advanceChildToEnd(); - } - break; - } - case LITERAL_goto: - { - TNode tmp123_AST = null; - tmp123_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp123_AST); - match(LITERAL_goto); - expr(); - astFactory.addASTChild(currentAST, returnAST); - match(SEMI); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_continue: - { - TNode tmp125_AST = null; - tmp125_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp125_AST); - match(LITERAL_continue); - match(SEMI); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_break: - { - TNode tmp127_AST = null; - tmp127_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp127_AST); - match(LITERAL_break); - match(SEMI); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_return: - { - TNode tmp129_AST = null; - tmp129_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp129_AST); - match(LITERAL_return); - { - switch ( LA(1)) { - case LITERAL_asm: - case ID: - case STAR: - case LPAREN: - case LAND: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case Number: - case LITERAL___alignof: - case LITERAL___real: - case LITERAL___imag: - { - expr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - match(SEMI); - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_case: - { - TNode tmp131_AST = null; - tmp131_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp131_AST); - match(LITERAL_case); - { - boolean synPredMatched153 = false; - if (((_tokenSet_2.member(LA(1))) && (_tokenSet_20.member(LA(2))))) { - int _m153 = mark(); - synPredMatched153 = true; - inputState.guessing++; - try { - { - constExpr(); - match(VARARGS); - } - } - catch (RecognitionException pe) { - synPredMatched153 = false; - } - rewind(_m153); - inputState.guessing--; - } - if ( synPredMatched153 ) { - rangeExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_2.member(LA(1))) && (_tokenSet_41.member(LA(2)))) { - constExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - match(COLON); - { - if ((_tokenSet_40.member(LA(1))) && (_tokenSet_42.member(LA(2)))) { - statement(); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_43.member(LA(1))) && (_tokenSet_44.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_default: - { - TNode tmp133_AST = null; - tmp133_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp133_AST); - match(LITERAL_default); - match(COLON); - { - if ((_tokenSet_40.member(LA(1))) && (_tokenSet_42.member(LA(2)))) { - statement(); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_43.member(LA(1))) && (_tokenSet_44.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_if: - { - TNode tmp135_AST = null; - tmp135_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp135_AST); - match(LITERAL_if); - match(LPAREN); - expr(); - astFactory.addASTChild(currentAST, returnAST); - match(RPAREN); - statement(); - astFactory.addASTChild(currentAST, returnAST); - { - if ((LA(1)==LITERAL_else) && (_tokenSet_40.member(LA(2)))) { - TNode tmp138_AST = null; - tmp138_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp138_AST); - match(LITERAL_else); - statement(); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_43.member(LA(1))) && (_tokenSet_44.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - statement_AST = (TNode)currentAST.root; - break; - } - case LITERAL_switch: - { - TNode tmp139_AST = null; - tmp139_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp139_AST); - match(LITERAL_switch); - match(LPAREN); - expr(); - astFactory.addASTChild(currentAST, returnAST); - match(RPAREN); - statement(); - astFactory.addASTChild(currentAST, returnAST); - statement_AST = (TNode)currentAST.root; - break; - } - default: - if ((_tokenSet_2.member(LA(1))) && (_tokenSet_45.member(LA(2)))) { - expr(); - astFactory.addASTChild(currentAST, returnAST); - match(SEMI); - if ( inputState.guessing==0 ) { - statement_AST = (TNode)currentAST.root; - statement_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NStatementExpr)).add(statement_AST)); - currentAST.root = statement_AST; - currentAST.child = statement_AST!=null &&statement_AST.getFirstChild()!=null ? - statement_AST.getFirstChild() : statement_AST; - currentAST.advanceChildToEnd(); - } - statement_AST = (TNode)currentAST.root; - } - else if ((LA(1)==ID) && (LA(2)==COLON)) { - TNode tmp143_AST = null; - tmp143_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp143_AST); - match(ID); - match(COLON); - { - if ((_tokenSet_40.member(LA(1))) && (_tokenSet_42.member(LA(2)))) { - statement(); - astFactory.addASTChild(currentAST, returnAST); - } - else if ((_tokenSet_43.member(LA(1))) && (_tokenSet_44.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - if ( inputState.guessing==0 ) { - statement_AST = (TNode)currentAST.root; - statement_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NLabel)).add(statement_AST)); - currentAST.root = statement_AST; - currentAST.child = statement_AST!=null &&statement_AST.getFirstChild()!=null ? - statement_AST.getFirstChild() : statement_AST; - currentAST.advanceChildToEnd(); - } - statement_AST = (TNode)currentAST.root; - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - } - returnAST = statement_AST; - } - - public final void conditionalExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode conditionalExpr_AST = null; - - logicalOrExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - switch ( LA(1)) { - case QUESTION: - { - TNode tmp145_AST = null; - tmp145_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp145_AST); - match(QUESTION); - { - switch ( LA(1)) { - case LITERAL_asm: - case ID: - case STAR: - case LPAREN: - case LAND: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case Number: - case LITERAL___alignof: - case LITERAL___real: - case LITERAL___imag: - { - expr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case COLON: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp146_AST = null; - tmp146_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp146_AST); - match(COLON); - conditionalExpr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LITERAL_asm: - case RCURLY: - case SEMI: - case COMMA: - case COLON: - case ASSIGN: - case RPAREN: - case RBRACKET: - case VARARGS: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case LITERAL___attribute: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - conditionalExpr_AST = (TNode)currentAST.root; - returnAST = conditionalExpr_AST; - } - - public final void logicalOrExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode logicalOrExpr_AST = null; - - logicalAndExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop266: - do { - if ((LA(1)==LOR)) { - TNode tmp147_AST = null; - tmp147_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp147_AST); - match(LOR); - logicalAndExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop266; - } - - } while (true); - } - logicalOrExpr_AST = (TNode)currentAST.root; - returnAST = logicalOrExpr_AST; - } - - public final void castExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode castExpr_AST = null; - - boolean synPredMatched163 = false; - if (((LA(1)==LPAREN) && (_tokenSet_30.member(LA(2))))) { - int _m163 = mark(); - synPredMatched163 = true; - inputState.guessing++; - try { - { - match(LPAREN); - typeName(); - match(RPAREN); - } - } - catch (RecognitionException pe) { - synPredMatched163 = false; - } - rewind(_m163); - inputState.guessing--; - } - if ( synPredMatched163 ) { - TNode tmp148_AST = null; - tmp148_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp148_AST); - match(LPAREN); - typeName(); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp149_AST = null; - tmp149_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp149_AST); - match(RPAREN); - { - switch ( LA(1)) { - case LITERAL_asm: - case ID: - case STAR: - case LPAREN: - case LAND: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case Number: - case LITERAL___alignof: - case LITERAL___real: - case LITERAL___imag: - { - castExpr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LCURLY: - { - lcurlyInitializer(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState.guessing==0 ) { - castExpr_AST = (TNode)currentAST.root; - castExpr_AST.setType(NCast); - } - castExpr_AST = (TNode)currentAST.root; - } - else if ((_tokenSet_2.member(LA(1))) && (_tokenSet_46.member(LA(2)))) { - unaryExpr(); - astFactory.addASTChild(currentAST, returnAST); - castExpr_AST = (TNode)currentAST.root; - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - returnAST = castExpr_AST; - } - - public final void unaryExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode unaryExpr_AST = null; - TNode u_AST = null; - - switch ( LA(1)) { - case ID: - case LPAREN: - case CharLiteral: - case StringLiteral: - case Number: - { - postfixExpr(); - astFactory.addASTChild(currentAST, returnAST); - unaryExpr_AST = (TNode)currentAST.root; - break; - } - case INC: - { - TNode tmp150_AST = null; - tmp150_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp150_AST); - match(INC); - castExpr(); - astFactory.addASTChild(currentAST, returnAST); - unaryExpr_AST = (TNode)currentAST.root; - break; - } - case DEC: - { - TNode tmp151_AST = null; - tmp151_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp151_AST); - match(DEC); - castExpr(); - astFactory.addASTChild(currentAST, returnAST); - unaryExpr_AST = (TNode)currentAST.root; - break; - } - case STAR: - case LAND: - case BAND: - case PLUS: - case MINUS: - case BNOT: - case LNOT: - case LITERAL___real: - case LITERAL___imag: - { - unaryOperator(); - u_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - castExpr(); - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - unaryExpr_AST = (TNode)currentAST.root; - unaryExpr_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NUnaryExpr)).add(unaryExpr_AST)); - currentAST.root = unaryExpr_AST; - currentAST.child = unaryExpr_AST!=null &&unaryExpr_AST.getFirstChild()!=null ? - unaryExpr_AST.getFirstChild() : unaryExpr_AST; - currentAST.advanceChildToEnd(); - } - unaryExpr_AST = (TNode)currentAST.root; - break; - } - case LITERAL_sizeof: - { - TNode tmp152_AST = null; - tmp152_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp152_AST); - match(LITERAL_sizeof); - { - boolean synPredMatched184 = false; - if (((LA(1)==LPAREN) && (_tokenSet_30.member(LA(2))))) { - int _m184 = mark(); - synPredMatched184 = true; - inputState.guessing++; - try { - { - match(LPAREN); - typeName(); - } - } - catch (RecognitionException pe) { - synPredMatched184 = false; - } - rewind(_m184); - inputState.guessing--; - } - if ( synPredMatched184 ) { - TNode tmp153_AST = null; - tmp153_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp153_AST); - match(LPAREN); - typeName(); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp154_AST = null; - tmp154_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp154_AST); - match(RPAREN); - } - else if ((_tokenSet_2.member(LA(1))) && (_tokenSet_46.member(LA(2)))) { - unaryExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - unaryExpr_AST = (TNode)currentAST.root; - break; - } - case LITERAL___alignof: - { - TNode tmp155_AST = null; - tmp155_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp155_AST); - match(LITERAL___alignof); - { - boolean synPredMatched187 = false; - if (((LA(1)==LPAREN) && (_tokenSet_30.member(LA(2))))) { - int _m187 = mark(); - synPredMatched187 = true; - inputState.guessing++; - try { - { - match(LPAREN); - typeName(); - } - } - catch (RecognitionException pe) { - synPredMatched187 = false; - } - rewind(_m187); - inputState.guessing--; - } - if ( synPredMatched187 ) { - TNode tmp156_AST = null; - tmp156_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp156_AST); - match(LPAREN); - typeName(); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp157_AST = null; - tmp157_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp157_AST); - match(RPAREN); - } - else if ((_tokenSet_2.member(LA(1))) && (_tokenSet_46.member(LA(2)))) { - unaryExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - unaryExpr_AST = (TNode)currentAST.root; - break; - } - case LITERAL_asm: - { - gnuAsmExpr(); - astFactory.addASTChild(currentAST, returnAST); - unaryExpr_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - returnAST = unaryExpr_AST; - } - - public final void nonemptyAbstractDeclarator() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode nonemptyAbstractDeclarator_AST = null; - - { - switch ( LA(1)) { - case STAR: - { - pointerGroup(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop173: - do { - switch ( LA(1)) { - case LPAREN: - { - { - TNode tmp158_AST = null; - tmp158_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp158_AST); - match(LPAREN); - { - switch ( LA(1)) { - case STAR: - case LPAREN: - case LBRACKET: - { - nonemptyAbstractDeclarator(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LITERAL_typedef: - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_auto: - case LITERAL_register: - case LITERAL_extern: - case LITERAL_static: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case ID: - case LITERAL_inline: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - parameterTypeList(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case COMMA: - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case COMMA: - { - match(COMMA); - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp160_AST = null; - tmp160_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp160_AST); - match(RPAREN); - } - break; - } - case LBRACKET: - { - { - TNode tmp161_AST = null; - tmp161_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp161_AST); - match(LBRACKET); - { - switch ( LA(1)) { - case LITERAL_asm: - case ID: - case STAR: - case LPAREN: - case LAND: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case Number: - case LITERAL___alignof: - case LITERAL___real: - case LITERAL___imag: - { - expr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RBRACKET: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp162_AST = null; - tmp162_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp162_AST); - match(RBRACKET); - } - break; - } - default: - { - break _loop173; - } - } - } while (true); - } - break; - } - case LPAREN: - case LBRACKET: - { - { - int _cnt180=0; - _loop180: - do { - switch ( LA(1)) { - case LPAREN: - { - { - TNode tmp163_AST = null; - tmp163_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp163_AST); - match(LPAREN); - { - switch ( LA(1)) { - case STAR: - case LPAREN: - case LBRACKET: - { - nonemptyAbstractDeclarator(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LITERAL_typedef: - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_auto: - case LITERAL_register: - case LITERAL_extern: - case LITERAL_static: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case ID: - case LITERAL_inline: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - parameterTypeList(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case COMMA: - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - switch ( LA(1)) { - case COMMA: - { - match(COMMA); - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp165_AST = null; - tmp165_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp165_AST); - match(RPAREN); - } - break; - } - case LBRACKET: - { - { - TNode tmp166_AST = null; - tmp166_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp166_AST); - match(LBRACKET); - { - switch ( LA(1)) { - case LITERAL_asm: - case ID: - case STAR: - case LPAREN: - case LAND: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case Number: - case LITERAL___alignof: - case LITERAL___real: - case LITERAL___imag: - { - expr(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RBRACKET: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp167_AST = null; - tmp167_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp167_AST); - match(RBRACKET); - } - break; - } - default: - { - if ( _cnt180>=1 ) { break _loop180; } else {throw new NoViableAltException(LT(1), getFilename());} - } - } - _cnt180++; - } while (true); - } - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - if ( inputState.guessing==0 ) { - nonemptyAbstractDeclarator_AST = (TNode)currentAST.root; - nonemptyAbstractDeclarator_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NNonemptyAbstractDeclarator)).add(nonemptyAbstractDeclarator_AST)); - currentAST.root = nonemptyAbstractDeclarator_AST; - currentAST.child = nonemptyAbstractDeclarator_AST!=null &&nonemptyAbstractDeclarator_AST.getFirstChild()!=null ? - nonemptyAbstractDeclarator_AST.getFirstChild() : nonemptyAbstractDeclarator_AST; - currentAST.advanceChildToEnd(); - } - nonemptyAbstractDeclarator_AST = (TNode)currentAST.root; - returnAST = nonemptyAbstractDeclarator_AST; - } - - public final void postfixExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode postfixExpr_AST = null; - - primaryExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - switch ( LA(1)) { - case LPAREN: - case LBRACKET: - case INC: - case DEC: - case PTR: - case DOT: - { - postfixSuffix(); - astFactory.addASTChild(currentAST, returnAST); - if ( inputState.guessing==0 ) { - postfixExpr_AST = (TNode)currentAST.root; - postfixExpr_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NPostfixExpr)).add(postfixExpr_AST)); - currentAST.root = postfixExpr_AST; - currentAST.child = postfixExpr_AST!=null &&postfixExpr_AST.getFirstChild()!=null ? - postfixExpr_AST.getFirstChild() : postfixExpr_AST; - currentAST.advanceChildToEnd(); - } - break; - } - case LITERAL_asm: - case RCURLY: - case SEMI: - case COMMA: - case COLON: - case ASSIGN: - case STAR: - case RPAREN: - case RBRACKET: - case VARARGS: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case LITERAL___attribute: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - postfixExpr_AST = (TNode)currentAST.root; - returnAST = postfixExpr_AST; - } - - public final void unaryOperator() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode unaryOperator_AST = null; - - switch ( LA(1)) { - case BAND: - { - TNode tmp168_AST = null; - tmp168_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp168_AST); - match(BAND); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - case STAR: - { - TNode tmp169_AST = null; - tmp169_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp169_AST); - match(STAR); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - case PLUS: - { - TNode tmp170_AST = null; - tmp170_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp170_AST); - match(PLUS); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - case MINUS: - { - TNode tmp171_AST = null; - tmp171_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp171_AST); - match(MINUS); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - case BNOT: - { - TNode tmp172_AST = null; - tmp172_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp172_AST); - match(BNOT); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - case LNOT: - { - TNode tmp173_AST = null; - tmp173_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp173_AST); - match(LNOT); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - case LAND: - { - TNode tmp174_AST = null; - tmp174_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp174_AST); - match(LAND); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - case LITERAL___real: - { - TNode tmp175_AST = null; - tmp175_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp175_AST); - match(LITERAL___real); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - case LITERAL___imag: - { - TNode tmp176_AST = null; - tmp176_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp176_AST); - match(LITERAL___imag); - unaryOperator_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - returnAST = unaryOperator_AST; - } - - public final void gnuAsmExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode gnuAsmExpr_AST = null; - - TNode tmp177_AST = null; - tmp177_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp177_AST); - match(LITERAL_asm); - { - switch ( LA(1)) { - case LITERAL_volatile: - { - TNode tmp178_AST = null; - tmp178_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp178_AST); - match(LITERAL_volatile); - break; - } - case LPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp179_AST = null; - tmp179_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp179_AST); - match(LPAREN); - stringConst(); - astFactory.addASTChild(currentAST, returnAST); - { - if ((LA(1)==COLON) && (_tokenSet_47.member(LA(2)))) { - TNode tmp180_AST = null; - tmp180_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp180_AST); - match(COLON); - { - switch ( LA(1)) { - case StringLiteral: - { - strOptExprPair(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop194: - do { - if ((LA(1)==COMMA)) { - TNode tmp181_AST = null; - tmp181_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp181_AST); - match(COMMA); - strOptExprPair(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop194; - } - - } while (true); - } - break; - } - case COLON: - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - { - if ((LA(1)==COLON) && (_tokenSet_47.member(LA(2)))) { - TNode tmp182_AST = null; - tmp182_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp182_AST); - match(COLON); - { - switch ( LA(1)) { - case StringLiteral: - { - strOptExprPair(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop198: - do { - if ((LA(1)==COMMA)) { - TNode tmp183_AST = null; - tmp183_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp183_AST); - match(COMMA); - strOptExprPair(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop198; - } - - } while (true); - } - break; - } - case COLON: - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - } - else if ((LA(1)==COLON||LA(1)==RPAREN) && (_tokenSet_48.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - } - else if ((LA(1)==COLON||LA(1)==RPAREN) && (_tokenSet_48.member(LA(2)))) { - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - { - switch ( LA(1)) { - case COLON: - { - TNode tmp184_AST = null; - tmp184_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp184_AST); - match(COLON); - stringConst(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop201: - do { - if ((LA(1)==COMMA)) { - TNode tmp185_AST = null; - tmp185_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp185_AST); - match(COMMA); - stringConst(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop201; - } - - } while (true); - } - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp186_AST = null; - tmp186_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp186_AST); - match(RPAREN); - if ( inputState.guessing==0 ) { - gnuAsmExpr_AST = (TNode)currentAST.root; - gnuAsmExpr_AST.setType(NGnuAsmExpr); - } - gnuAsmExpr_AST = (TNode)currentAST.root; - returnAST = gnuAsmExpr_AST; - } - - public final void strOptExprPair() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode strOptExprPair_AST = null; - - stringConst(); - astFactory.addASTChild(currentAST, returnAST); - { - switch ( LA(1)) { - case LPAREN: - { - TNode tmp187_AST = null; - tmp187_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp187_AST); - match(LPAREN); - expr(); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp188_AST = null; - tmp188_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp188_AST); - match(RPAREN); - break; - } - case COMMA: - case COLON: - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - strOptExprPair_AST = (TNode)currentAST.root; - returnAST = strOptExprPair_AST; - } - - public final void primaryExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode primaryExpr_AST = null; - - switch ( LA(1)) { - case ID: - { - TNode tmp189_AST = null; - tmp189_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp189_AST); - match(ID); - primaryExpr_AST = (TNode)currentAST.root; - break; - } - case Number: - { - TNode tmp190_AST = null; - tmp190_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp190_AST); - match(Number); - primaryExpr_AST = (TNode)currentAST.root; - break; - } - case CharLiteral: - { - charConst(); - astFactory.addASTChild(currentAST, returnAST); - primaryExpr_AST = (TNode)currentAST.root; - break; - } - case StringLiteral: - { - stringConst(); - astFactory.addASTChild(currentAST, returnAST); - primaryExpr_AST = (TNode)currentAST.root; - break; - } - default: - boolean synPredMatched206 = false; - if (((LA(1)==LPAREN) && (LA(2)==LCURLY))) { - int _m206 = mark(); - synPredMatched206 = true; - inputState.guessing++; - try { - { - match(LPAREN); - match(LCURLY); - } - } - catch (RecognitionException pe) { - synPredMatched206 = false; - } - rewind(_m206); - inputState.guessing--; - } - if ( synPredMatched206 ) { - TNode tmp191_AST = null; - tmp191_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp191_AST); - match(LPAREN); - compoundStatement(getAScopeName()); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp192_AST = null; - tmp192_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp192_AST); - match(RPAREN); - primaryExpr_AST = (TNode)currentAST.root; - } - else if ((LA(1)==LPAREN) && (_tokenSet_2.member(LA(2)))) { - TNode tmp193_AST = null; - tmp193_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp193_AST); - match(LPAREN); - expr(); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp194_AST = null; - tmp194_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp194_AST); - match(RPAREN); - if ( inputState.guessing==0 ) { - primaryExpr_AST = (TNode)currentAST.root; - primaryExpr_AST.setType(NExpressionGroup); - } - primaryExpr_AST = (TNode)currentAST.root; - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - } - returnAST = primaryExpr_AST; - } - - protected final void charConst() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode charConst_AST = null; - - TNode tmp195_AST = null; - tmp195_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp195_AST); - match(CharLiteral); - charConst_AST = (TNode)currentAST.root; - returnAST = charConst_AST; - } - - public final void storageClassSpecifier() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode storageClassSpecifier_AST = null; - - switch ( LA(1)) { - case LITERAL_auto: - { - TNode tmp196_AST = null; - tmp196_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp196_AST); - match(LITERAL_auto); - storageClassSpecifier_AST = (TNode)currentAST.root; - break; - } - case LITERAL_register: - { - TNode tmp197_AST = null; - tmp197_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp197_AST); - match(LITERAL_register); - storageClassSpecifier_AST = (TNode)currentAST.root; - break; - } - case LITERAL_typedef: - { - TNode tmp198_AST = null; - tmp198_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp198_AST); - match(LITERAL_typedef); - storageClassSpecifier_AST = (TNode)currentAST.root; - break; - } - case LITERAL_extern: - case LITERAL_static: - case LITERAL_inline: - { - functionStorageClassSpecifier(); - astFactory.addASTChild(currentAST, returnAST); - storageClassSpecifier_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - returnAST = storageClassSpecifier_AST; - } - - public final void typeQualifier() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode typeQualifier_AST = null; - - switch ( LA(1)) { - case LITERAL_const: - { - TNode tmp199_AST = null; - tmp199_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp199_AST); - match(LITERAL_const); - typeQualifier_AST = (TNode)currentAST.root; - break; - } - case LITERAL_volatile: - { - TNode tmp200_AST = null; - tmp200_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp200_AST); - match(LITERAL_volatile); - typeQualifier_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - returnAST = typeQualifier_AST; - } - - public final void assignOperator() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode assignOperator_AST = null; - - switch ( LA(1)) { - case ASSIGN: - { - TNode tmp201_AST = null; - tmp201_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp201_AST); - match(ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case DIV_ASSIGN: - { - TNode tmp202_AST = null; - tmp202_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp202_AST); - match(DIV_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case PLUS_ASSIGN: - { - TNode tmp203_AST = null; - tmp203_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp203_AST); - match(PLUS_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case MINUS_ASSIGN: - { - TNode tmp204_AST = null; - tmp204_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp204_AST); - match(MINUS_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case STAR_ASSIGN: - { - TNode tmp205_AST = null; - tmp205_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp205_AST); - match(STAR_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case MOD_ASSIGN: - { - TNode tmp206_AST = null; - tmp206_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp206_AST); - match(MOD_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case RSHIFT_ASSIGN: - { - TNode tmp207_AST = null; - tmp207_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp207_AST); - match(RSHIFT_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case LSHIFT_ASSIGN: - { - TNode tmp208_AST = null; - tmp208_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp208_AST); - match(LSHIFT_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case BAND_ASSIGN: - { - TNode tmp209_AST = null; - tmp209_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp209_AST); - match(BAND_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case BOR_ASSIGN: - { - TNode tmp210_AST = null; - tmp210_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp210_AST); - match(BOR_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - case BXOR_ASSIGN: - { - TNode tmp211_AST = null; - tmp211_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp211_AST); - match(BXOR_ASSIGN); - assignOperator_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - returnAST = assignOperator_AST; - } - - public final void logicalAndExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode logicalAndExpr_AST = null; - - inclusiveOrExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop269: - do { - if ((LA(1)==LAND)) { - TNode tmp212_AST = null; - tmp212_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp212_AST); - match(LAND); - inclusiveOrExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop269; - } - - } while (true); - } - logicalAndExpr_AST = (TNode)currentAST.root; - returnAST = logicalAndExpr_AST; - } - - public final void inclusiveOrExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode inclusiveOrExpr_AST = null; - - exclusiveOrExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop272: - do { - if ((LA(1)==BOR)) { - TNode tmp213_AST = null; - tmp213_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp213_AST); - match(BOR); - exclusiveOrExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop272; - } - - } while (true); - } - inclusiveOrExpr_AST = (TNode)currentAST.root; - returnAST = inclusiveOrExpr_AST; - } - - public final void exclusiveOrExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode exclusiveOrExpr_AST = null; - - bitAndExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop275: - do { - if ((LA(1)==BXOR)) { - TNode tmp214_AST = null; - tmp214_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp214_AST); - match(BXOR); - bitAndExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop275; - } - - } while (true); - } - exclusiveOrExpr_AST = (TNode)currentAST.root; - returnAST = exclusiveOrExpr_AST; - } - - public final void bitAndExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode bitAndExpr_AST = null; - - equalityExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop278: - do { - if ((LA(1)==BAND)) { - TNode tmp215_AST = null; - tmp215_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp215_AST); - match(BAND); - equalityExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop278; - } - - } while (true); - } - bitAndExpr_AST = (TNode)currentAST.root; - returnAST = bitAndExpr_AST; - } - - public final void equalityExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode equalityExpr_AST = null; - - relationalExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop282: - do { - if ((LA(1)==EQUAL||LA(1)==NOT_EQUAL)) { - { - switch ( LA(1)) { - case EQUAL: - { - TNode tmp216_AST = null; - tmp216_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp216_AST); - match(EQUAL); - break; - } - case NOT_EQUAL: - { - TNode tmp217_AST = null; - tmp217_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp217_AST); - match(NOT_EQUAL); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - relationalExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop282; - } - - } while (true); - } - equalityExpr_AST = (TNode)currentAST.root; - returnAST = equalityExpr_AST; - } - - public final void relationalExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode relationalExpr_AST = null; - - shiftExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop286: - do { - if (((LA(1) >= LT && LA(1) <= GTE))) { - { - switch ( LA(1)) { - case LT: - { - TNode tmp218_AST = null; - tmp218_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp218_AST); - match(LT); - break; - } - case LTE: - { - TNode tmp219_AST = null; - tmp219_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp219_AST); - match(LTE); - break; - } - case GT: - { - TNode tmp220_AST = null; - tmp220_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp220_AST); - match(GT); - break; - } - case GTE: - { - TNode tmp221_AST = null; - tmp221_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp221_AST); - match(GTE); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - shiftExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop286; - } - - } while (true); - } - relationalExpr_AST = (TNode)currentAST.root; - returnAST = relationalExpr_AST; - } - - public final void shiftExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode shiftExpr_AST = null; - - additiveExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop290: - do { - if ((LA(1)==LSHIFT||LA(1)==RSHIFT)) { - { - switch ( LA(1)) { - case LSHIFT: - { - TNode tmp222_AST = null; - tmp222_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp222_AST); - match(LSHIFT); - break; - } - case RSHIFT: - { - TNode tmp223_AST = null; - tmp223_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp223_AST); - match(RSHIFT); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - additiveExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop290; - } - - } while (true); - } - shiftExpr_AST = (TNode)currentAST.root; - returnAST = shiftExpr_AST; - } - - public final void additiveExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode additiveExpr_AST = null; - - multExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop294: - do { - if ((LA(1)==PLUS||LA(1)==MINUS)) { - { - switch ( LA(1)) { - case PLUS: - { - TNode tmp224_AST = null; - tmp224_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp224_AST); - match(PLUS); - break; - } - case MINUS: - { - TNode tmp225_AST = null; - tmp225_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp225_AST); - match(MINUS); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - multExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop294; - } - - } while (true); - } - additiveExpr_AST = (TNode)currentAST.root; - returnAST = additiveExpr_AST; - } - - public final void multExpr() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode multExpr_AST = null; - - castExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop298: - do { - if ((_tokenSet_49.member(LA(1)))) { - { - switch ( LA(1)) { - case STAR: - { - TNode tmp226_AST = null; - tmp226_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp226_AST); - match(STAR); - break; - } - case DIV: - { - TNode tmp227_AST = null; - tmp227_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp227_AST); - match(DIV); - break; - } - case MOD: - { - TNode tmp228_AST = null; - tmp228_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp228_AST); - match(MOD); - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - castExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop298; - } - - } while (true); - } - multExpr_AST = (TNode)currentAST.root; - returnAST = multExpr_AST; - } - - public final void postfixSuffix() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode postfixSuffix_AST = null; - - { - int _cnt305=0; - _loop305: - do { - switch ( LA(1)) { - case PTR: - { - TNode tmp229_AST = null; - tmp229_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp229_AST); - match(PTR); - TNode tmp230_AST = null; - tmp230_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp230_AST); - match(ID); - break; - } - case DOT: - { - TNode tmp231_AST = null; - tmp231_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp231_AST); - match(DOT); - TNode tmp232_AST = null; - tmp232_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp232_AST); - match(ID); - break; - } - case LPAREN: - { - functionCall(); - astFactory.addASTChild(currentAST, returnAST); - break; - } - case LBRACKET: - { - TNode tmp233_AST = null; - tmp233_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp233_AST); - match(LBRACKET); - expr(); - astFactory.addASTChild(currentAST, returnAST); - TNode tmp234_AST = null; - tmp234_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp234_AST); - match(RBRACKET); - break; - } - case INC: - { - TNode tmp235_AST = null; - tmp235_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp235_AST); - match(INC); - break; - } - case DEC: - { - TNode tmp236_AST = null; - tmp236_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp236_AST); - match(DEC); - break; - } - default: - { - if ( _cnt305>=1 ) { break _loop305; } else {throw new NoViableAltException(LT(1), getFilename());} - } - } - _cnt305++; - } while (true); - } - postfixSuffix_AST = (TNode)currentAST.root; - returnAST = postfixSuffix_AST; - } - - public final void functionCall() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode functionCall_AST = null; - TNode a_AST = null; - - TNode tmp237_AST = null; - tmp237_AST = (TNode)astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp237_AST); - match(LPAREN); - { - switch ( LA(1)) { - case LITERAL_asm: - case ID: - case STAR: - case LPAREN: - case LAND: - case BAND: - case PLUS: - case MINUS: - case INC: - case DEC: - case LITERAL_sizeof: - case BNOT: - case LNOT: - case CharLiteral: - case StringLiteral: - case Number: - case LITERAL___alignof: - case LITERAL___real: - case LITERAL___imag: - { - argExprList(); - a_AST = (TNode)returnAST; - astFactory.addASTChild(currentAST, returnAST); - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - TNode tmp238_AST = null; - tmp238_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp238_AST); - match(RPAREN); - if ( inputState.guessing==0 ) { - functionCall_AST = (TNode)currentAST.root; - - functionCall_AST.setType( NFunctionCallArgs ); - - } - functionCall_AST = (TNode)currentAST.root; - returnAST = functionCall_AST; - } - - public final void argExprList() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode argExprList_AST = null; - - assignExpr(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop310: - do { - if ((LA(1)==COMMA)) { - match(COMMA); - assignExpr(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop310; - } - - } while (true); - } - argExprList_AST = (TNode)currentAST.root; - returnAST = argExprList_AST; - } - - protected final void intConst() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode intConst_AST = null; - - switch ( LA(1)) { - case IntOctalConst: - { - TNode tmp240_AST = null; - tmp240_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp240_AST); - match(IntOctalConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case LongOctalConst: - { - TNode tmp241_AST = null; - tmp241_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp241_AST); - match(LongOctalConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case UnsignedOctalConst: - { - TNode tmp242_AST = null; - tmp242_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp242_AST); - match(UnsignedOctalConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case IntIntConst: - { - TNode tmp243_AST = null; - tmp243_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp243_AST); - match(IntIntConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case LongIntConst: - { - TNode tmp244_AST = null; - tmp244_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp244_AST); - match(LongIntConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case UnsignedIntConst: - { - TNode tmp245_AST = null; - tmp245_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp245_AST); - match(UnsignedIntConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case IntHexConst: - { - TNode tmp246_AST = null; - tmp246_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp246_AST); - match(IntHexConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case LongHexConst: - { - TNode tmp247_AST = null; - tmp247_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp247_AST); - match(LongHexConst); - intConst_AST = (TNode)currentAST.root; - break; - } - case UnsignedHexConst: - { - TNode tmp248_AST = null; - tmp248_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp248_AST); - match(UnsignedHexConst); - intConst_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - returnAST = intConst_AST; - } - - protected final void floatConst() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode floatConst_AST = null; - - switch ( LA(1)) { - case FloatDoubleConst: - { - TNode tmp249_AST = null; - tmp249_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp249_AST); - match(FloatDoubleConst); - floatConst_AST = (TNode)currentAST.root; - break; - } - case DoubleDoubleConst: - { - TNode tmp250_AST = null; - tmp250_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp250_AST); - match(DoubleDoubleConst); - floatConst_AST = (TNode)currentAST.root; - break; - } - case LongDoubleConst: - { - TNode tmp251_AST = null; - tmp251_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp251_AST); - match(LongDoubleConst); - floatConst_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - returnAST = floatConst_AST; - } - - public final void dummy() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - TNode dummy_AST = null; - - switch ( LA(1)) { - case NTypedefName: - { - TNode tmp252_AST = null; - tmp252_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp252_AST); - match(NTypedefName); - dummy_AST = (TNode)currentAST.root; - break; - } - case NInitDecl: - { - TNode tmp253_AST = null; - tmp253_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp253_AST); - match(NInitDecl); - dummy_AST = (TNode)currentAST.root; - break; - } - case NDeclarator: - { - TNode tmp254_AST = null; - tmp254_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp254_AST); - match(NDeclarator); - dummy_AST = (TNode)currentAST.root; - break; - } - case NStructDeclarator: - { - TNode tmp255_AST = null; - tmp255_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp255_AST); - match(NStructDeclarator); - dummy_AST = (TNode)currentAST.root; - break; - } - case NDeclaration: - { - TNode tmp256_AST = null; - tmp256_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp256_AST); - match(NDeclaration); - dummy_AST = (TNode)currentAST.root; - break; - } - case NCast: - { - TNode tmp257_AST = null; - tmp257_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp257_AST); - match(NCast); - dummy_AST = (TNode)currentAST.root; - break; - } - case NPointerGroup: - { - TNode tmp258_AST = null; - tmp258_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp258_AST); - match(NPointerGroup); - dummy_AST = (TNode)currentAST.root; - break; - } - case NExpressionGroup: - { - TNode tmp259_AST = null; - tmp259_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp259_AST); - match(NExpressionGroup); - dummy_AST = (TNode)currentAST.root; - break; - } - case NFunctionCallArgs: - { - TNode tmp260_AST = null; - tmp260_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp260_AST); - match(NFunctionCallArgs); - dummy_AST = (TNode)currentAST.root; - break; - } - case NNonemptyAbstractDeclarator: - { - TNode tmp261_AST = null; - tmp261_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp261_AST); - match(NNonemptyAbstractDeclarator); - dummy_AST = (TNode)currentAST.root; - break; - } - case NInitializer: - { - TNode tmp262_AST = null; - tmp262_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp262_AST); - match(NInitializer); - dummy_AST = (TNode)currentAST.root; - break; - } - case NStatementExpr: - { - TNode tmp263_AST = null; - tmp263_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp263_AST); - match(NStatementExpr); - dummy_AST = (TNode)currentAST.root; - break; - } - case NEmptyExpression: - { - TNode tmp264_AST = null; - tmp264_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp264_AST); - match(NEmptyExpression); - dummy_AST = (TNode)currentAST.root; - break; - } - case NParameterTypeList: - { - TNode tmp265_AST = null; - tmp265_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp265_AST); - match(NParameterTypeList); - dummy_AST = (TNode)currentAST.root; - break; - } - case NFunctionDef: - { - TNode tmp266_AST = null; - tmp266_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp266_AST); - match(NFunctionDef); - dummy_AST = (TNode)currentAST.root; - break; - } - case NCompoundStatement: - { - TNode tmp267_AST = null; - tmp267_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp267_AST); - match(NCompoundStatement); - dummy_AST = (TNode)currentAST.root; - break; - } - case NParameterDeclaration: - { - TNode tmp268_AST = null; - tmp268_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp268_AST); - match(NParameterDeclaration); - dummy_AST = (TNode)currentAST.root; - break; - } - case NCommaExpr: - { - TNode tmp269_AST = null; - tmp269_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp269_AST); - match(NCommaExpr); - dummy_AST = (TNode)currentAST.root; - break; - } - case NUnaryExpr: - { - TNode tmp270_AST = null; - tmp270_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp270_AST); - match(NUnaryExpr); - dummy_AST = (TNode)currentAST.root; - break; - } - case NLabel: - { - TNode tmp271_AST = null; - tmp271_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp271_AST); - match(NLabel); - dummy_AST = (TNode)currentAST.root; - break; - } - case NPostfixExpr: - { - TNode tmp272_AST = null; - tmp272_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp272_AST); - match(NPostfixExpr); - dummy_AST = (TNode)currentAST.root; - break; - } - case NRangeExpr: - { - TNode tmp273_AST = null; - tmp273_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp273_AST); - match(NRangeExpr); - dummy_AST = (TNode)currentAST.root; - break; - } - case NStringSeq: - { - TNode tmp274_AST = null; - tmp274_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp274_AST); - match(NStringSeq); - dummy_AST = (TNode)currentAST.root; - break; - } - case NInitializerElementLabel: - { - TNode tmp275_AST = null; - tmp275_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp275_AST); - match(NInitializerElementLabel); - dummy_AST = (TNode)currentAST.root; - break; - } - case NLcurlyInitializer: - { - TNode tmp276_AST = null; - tmp276_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp276_AST); - match(NLcurlyInitializer); - dummy_AST = (TNode)currentAST.root; - break; - } - case NAsmAttribute: - { - TNode tmp277_AST = null; - tmp277_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp277_AST); - match(NAsmAttribute); - dummy_AST = (TNode)currentAST.root; - break; - } - case NGnuAsmExpr: - { - TNode tmp278_AST = null; - tmp278_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp278_AST); - match(NGnuAsmExpr); - dummy_AST = (TNode)currentAST.root; - break; - } - case NTypeMissing: - { - TNode tmp279_AST = null; - tmp279_AST = (TNode)astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp279_AST); - match(NTypeMissing); - dummy_AST = (TNode)currentAST.root; - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - returnAST = dummy_AST; - } - - - public static final String[] _tokenNames = { - "<0>", - "EOF", - "<2>", - "NULL_TREE_LOOKAHEAD", - "\"typedef\"", - "\"asm\"", - "\"volatile\"", - "LCURLY", - "RCURLY", - "SEMI", - "\"struct\"", - "\"union\"", - "\"enum\"", - "\"auto\"", - "\"register\"", - "\"extern\"", - "\"static\"", - "\"const\"", - "\"void\"", - "\"char\"", - "\"short\"", - "\"int\"", - "\"long\"", - "\"float\"", - "\"double\"", - "\"signed\"", - "\"unsigned\"", - "ID", - "COMMA", - "COLON", - "ASSIGN", - "STAR", - "LPAREN", - "RPAREN", - "LBRACKET", - "RBRACKET", - "VARARGS", - "\"while\"", - "\"do\"", - "\"for\"", - "\"goto\"", - "\"continue\"", - "\"break\"", - "\"return\"", - "\"case\"", - "\"default\"", - "\"if\"", - "\"else\"", - "\"switch\"", - "DIV_ASSIGN", - "PLUS_ASSIGN", - "MINUS_ASSIGN", - "STAR_ASSIGN", - "MOD_ASSIGN", - "RSHIFT_ASSIGN", - "LSHIFT_ASSIGN", - "BAND_ASSIGN", - "BOR_ASSIGN", - "BXOR_ASSIGN", - "QUESTION", - "LOR", - "LAND", - "BOR", - "BXOR", - "BAND", - "EQUAL", - "NOT_EQUAL", - "LT", - "LTE", - "GT", - "GTE", - "LSHIFT", - "RSHIFT", - "PLUS", - "MINUS", - "DIV", - "MOD", - "INC", - "DEC", - "\"sizeof\"", - "BNOT", - "LNOT", - "PTR", - "DOT", - "CharLiteral", - "StringLiteral", - "IntOctalConst", - "LongOctalConst", - "UnsignedOctalConst", - "IntIntConst", - "LongIntConst", - "UnsignedIntConst", - "IntHexConst", - "LongHexConst", - "UnsignedHexConst", - "FloatDoubleConst", - "DoubleDoubleConst", - "LongDoubleConst", - "NTypedefName", - "NInitDecl", - "NDeclarator", - "NStructDeclarator", - "NDeclaration", - "NCast", - "NPointerGroup", - "NExpressionGroup", - "NFunctionCallArgs", - "NNonemptyAbstractDeclarator", - "NInitializer", - "NStatementExpr", - "NEmptyExpression", - "NParameterTypeList", - "NFunctionDef", - "NCompoundStatement", - "NParameterDeclaration", - "NCommaExpr", - "NUnaryExpr", - "NLabel", - "NPostfixExpr", - "NRangeExpr", - "NStringSeq", - "NInitializerElementLabel", - "NLcurlyInitializer", - "NAsmAttribute", - "NGnuAsmExpr", - "NTypeMissing", - "Vocabulary", - "Whitespace", - "Comment", - "CPPComment", - "a line directive", - "Space", - "LineDirective", - "BadStringLiteral", - "Escape", - "Digit", - "LongSuffix", - "UnsignedSuffix", - "FloatSuffix", - "Exponent", - "Number", - "\"__label__\"", - "\"inline\"", - "\"byte\"", - "\"boolean\"", - "\"Servo\"", - "\"Wire\"", - "\"typeof\"", - "\"__complex\"", - "\"__attribute\"", - "\"__alignof\"", - "\"__real\"", - "\"__imag\"" - }; - - protected void buildTokenTypeASTClassMap() { - tokenTypeToASTClassMap=null; - }; - - private static final long[] mk_tokenSet_0() { - long[] data = { 6710886000L, 0L, 2080768L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); - private static final long[] mk_tokenSet_1() { - long[] data = { 6710886002L, 0L, 2080768L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); - private static final long[] mk_tokenSet_2() { - long[] data = { 2305843015790362656L, 3401217L, 29364224L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); - private static final long[] mk_tokenSet_3() { - long[] data = { 268434512L, 0L, 2080768L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3()); - private static final long[] mk_tokenSet_4() { - long[] data = { 6710886096L, 0L, 2080768L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4()); - private static final long[] mk_tokenSet_5() { - long[] data = { 6710860864L, 0L, 2080768L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5()); - private static final long[] mk_tokenSet_6() { - long[] data = { 92610232016L, 0L, 2080768L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6()); - private static final long[] mk_tokenSet_7() { - long[] data = { 6576668672L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7()); - private static final long[] mk_tokenSet_8() { - long[] data = { 25635717728L, 0L, 2097152L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8()); - private static final long[] mk_tokenSet_9() { - long[] data = { 2306265159670169586L, 3401217L, 31453184L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9()); - private static final long[] mk_tokenSet_10() { - long[] data = { 268409920L, 0L, 2080768L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_10 = new BitSet(mk_tokenSet_10()); - private static final long[] mk_tokenSet_11() { - long[] data = { 6710860992L, 0L, 2080768L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_11 = new BitSet(mk_tokenSet_11()); - private static final long[] mk_tokenSet_12() { - long[] data = { 268180480L, 0L, 2064384L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_12 = new BitSet(mk_tokenSet_12()); - private static final long[] mk_tokenSet_13() { - long[] data = { 2305843032970231968L, 3925505L, 29364224L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_13 = new BitSet(mk_tokenSet_13()); - private static final long[] mk_tokenSet_14() { - long[] data = { -562924183740448L, 4194303L, 31428608L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_14 = new BitSet(mk_tokenSet_14()); - private static final long[] mk_tokenSet_15() { - long[] data = { 17314086912L, 524288L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_15 = new BitSet(mk_tokenSet_15()); - private static final long[] mk_tokenSet_16() { - long[] data = { 2305843016327233568L, 3401217L, 29364224L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_16 = new BitSet(mk_tokenSet_16()); - private static final long[] mk_tokenSet_17() { - long[] data = { 2305843015790362784L, 3401217L, 29364224L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_17 = new BitSet(mk_tokenSet_17()); - private static final long[] mk_tokenSet_18() { - long[] data = { -562924720611360L, 4194303L, 31428608L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_18 = new BitSet(mk_tokenSet_18()); - private static final long[] mk_tokenSet_19() { - long[] data = { 2305843032970232224L, 3925505L, 29364224L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_19 = new BitSet(mk_tokenSet_19()); - private static final long[] mk_tokenSet_20() { - long[] data = { -576460659693314848L, 4194303L, 31428608L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_20 = new BitSet(mk_tokenSet_20()); - private static final long[] mk_tokenSet_21() { - long[] data = { -576460694053053216L, 4194303L, 31428608L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_21 = new BitSet(mk_tokenSet_21()); - private static final long[] mk_tokenSet_22() { - long[] data = { 32749125328L, 0L, 2080768L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_22 = new BitSet(mk_tokenSet_22()); - private static final long[] mk_tokenSet_23() { - long[] data = { 8992587776L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_23 = new BitSet(mk_tokenSet_23()); - private static final long[] mk_tokenSet_24() { - long[] data = { 100931731184L, 0L, 4177920L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_24 = new BitSet(mk_tokenSet_24()); - private static final long[] mk_tokenSet_25() { - long[] data = { 32615039552L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_25 = new BitSet(mk_tokenSet_25()); - private static final long[] mk_tokenSet_26() { - long[] data = { 23622320128L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_26 = new BitSet(mk_tokenSet_26()); - private static final long[] mk_tokenSet_27() { - long[] data = { 2305843076322557552L, 3401217L, 31444992L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_27 = new BitSet(mk_tokenSet_27()); - private static final long[] mk_tokenSet_28() { - long[] data = { 8858370560L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_28 = new BitSet(mk_tokenSet_28()); - private static final long[] mk_tokenSet_29() { - long[] data = { 2306265090950692848L, 3401217L, 31453184L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_29 = new BitSet(mk_tokenSet_29()); - private static final long[] mk_tokenSet_30() { - long[] data = { 268311616L, 0L, 2064384L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_30 = new BitSet(mk_tokenSet_30()); - private static final long[] mk_tokenSet_31() { - long[] data = { 32480566464L, 0L, 2064384L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_31 = new BitSet(mk_tokenSet_31()); - private static final long[] mk_tokenSet_32() { - long[] data = { -562916130677536L, 4194303L, 31428608L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_32 = new BitSet(mk_tokenSet_32()); - private static final long[] mk_tokenSet_33() { - long[] data = { 33285996144L, 0L, 4177920L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_33 = new BitSet(mk_tokenSet_33()); - private static final long[] mk_tokenSet_34() { - long[] data = { 33285873376L, 0L, 4161536L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_34 = new BitSet(mk_tokenSet_34()); - private static final long[] mk_tokenSet_35() { - long[] data = { 7381975584L, 0L, 2097152L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_35 = new BitSet(mk_tokenSet_35()); - private static final long[] mk_tokenSet_36() { - long[] data = { -13153337360L, -1L, 33554431L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_36 = new BitSet(mk_tokenSet_36()); - private static final long[] mk_tokenSet_37() { - long[] data = { 268434512L, 0L, 2088960L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_37 = new BitSet(mk_tokenSet_37()); - private static final long[] mk_tokenSet_38() { - long[] data = { 6710869056L, 0L, 2080768L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_38 = new BitSet(mk_tokenSet_38()); - private static final long[] mk_tokenSet_39() { - long[] data = { 23890754768L, 0L, 2080768L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_39 = new BitSet(mk_tokenSet_39()); - private static final long[] mk_tokenSet_40() { - long[] data = { 2306265090816475808L, 3401217L, 29364224L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_40 = new BitSet(mk_tokenSet_40()); - private static final long[] mk_tokenSet_41() { - long[] data = { -576460727875920672L, 4194303L, 31428608L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_41 = new BitSet(mk_tokenSet_41()); - private static final long[] mk_tokenSet_42() { - long[] data = { -111669149712L, 4194303L, 31453184L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_42 = new BitSet(mk_tokenSet_42()); - private static final long[] mk_tokenSet_43() { - long[] data = { 2306405828304831392L, 3401217L, 29364224L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_43 = new BitSet(mk_tokenSet_43()); - private static final long[] mk_tokenSet_44() { - long[] data = { -103079215118L, 4194303L, 31453184L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_44 = new BitSet(mk_tokenSet_44()); - private static final long[] mk_tokenSet_45() { - long[] data = { -562924720611616L, 4194303L, 31428608L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_45 = new BitSet(mk_tokenSet_45()); - private static final long[] mk_tokenSet_46() { - long[] data = { -562812648684576L, 4194303L, 31461376L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_46 = new BitSet(mk_tokenSet_46()); - private static final long[] mk_tokenSet_47() { - long[] data = { 9126805504L, 2097152L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_47 = new BitSet(mk_tokenSet_47()); - private static final long[] mk_tokenSet_48() { - long[] data = { -562834257738976L, 2105343L, 2097152L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_48 = new BitSet(mk_tokenSet_48()); - private static final long[] mk_tokenSet_49() { - long[] data = { 2147483648L, 6144L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_49 = new BitSet(mk_tokenSet_49()); - - } diff --git a/app/preproc/WTokenTypes.java b/app/preproc/WTokenTypes.java deleted file mode 100644 index 67b13a844..000000000 --- a/app/preproc/WTokenTypes.java +++ /dev/null @@ -1,162 +0,0 @@ -// $ANTLR 2.7.2: "expandedWParser.g" -> "WLexer.java"$ - -package processing.app.preproc; - -import java.io.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; - -public interface WTokenTypes { - int EOF = 1; - int NULL_TREE_LOOKAHEAD = 3; - int LITERAL_typedef = 4; - int LITERAL_asm = 5; - int LITERAL_volatile = 6; - int LCURLY = 7; - int RCURLY = 8; - int SEMI = 9; - int LITERAL_struct = 10; - int LITERAL_union = 11; - int LITERAL_enum = 12; - int LITERAL_auto = 13; - int LITERAL_register = 14; - int LITERAL_extern = 15; - int LITERAL_static = 16; - int LITERAL_const = 17; - int LITERAL_void = 18; - int LITERAL_char = 19; - int LITERAL_short = 20; - int LITERAL_int = 21; - int LITERAL_long = 22; - int LITERAL_float = 23; - int LITERAL_double = 24; - int LITERAL_signed = 25; - int LITERAL_unsigned = 26; - int ID = 27; - int COMMA = 28; - int COLON = 29; - int ASSIGN = 30; - int STAR = 31; - int LPAREN = 32; - int RPAREN = 33; - int LBRACKET = 34; - int RBRACKET = 35; - int VARARGS = 36; - int LITERAL_while = 37; - int LITERAL_do = 38; - int LITERAL_for = 39; - int LITERAL_goto = 40; - int LITERAL_continue = 41; - int LITERAL_break = 42; - int LITERAL_return = 43; - int LITERAL_case = 44; - int LITERAL_default = 45; - int LITERAL_if = 46; - int LITERAL_else = 47; - int LITERAL_switch = 48; - int DIV_ASSIGN = 49; - int PLUS_ASSIGN = 50; - int MINUS_ASSIGN = 51; - int STAR_ASSIGN = 52; - int MOD_ASSIGN = 53; - int RSHIFT_ASSIGN = 54; - int LSHIFT_ASSIGN = 55; - int BAND_ASSIGN = 56; - int BOR_ASSIGN = 57; - int BXOR_ASSIGN = 58; - int QUESTION = 59; - int LOR = 60; - int LAND = 61; - int BOR = 62; - int BXOR = 63; - int BAND = 64; - int EQUAL = 65; - int NOT_EQUAL = 66; - int LT = 67; - int LTE = 68; - int GT = 69; - int GTE = 70; - int LSHIFT = 71; - int RSHIFT = 72; - int PLUS = 73; - int MINUS = 74; - int DIV = 75; - int MOD = 76; - int INC = 77; - int DEC = 78; - int LITERAL_sizeof = 79; - int BNOT = 80; - int LNOT = 81; - int PTR = 82; - int DOT = 83; - int CharLiteral = 84; - int StringLiteral = 85; - int IntOctalConst = 86; - int LongOctalConst = 87; - int UnsignedOctalConst = 88; - int IntIntConst = 89; - int LongIntConst = 90; - int UnsignedIntConst = 91; - int IntHexConst = 92; - int LongHexConst = 93; - int UnsignedHexConst = 94; - int FloatDoubleConst = 95; - int DoubleDoubleConst = 96; - int LongDoubleConst = 97; - int NTypedefName = 98; - int NInitDecl = 99; - int NDeclarator = 100; - int NStructDeclarator = 101; - int NDeclaration = 102; - int NCast = 103; - int NPointerGroup = 104; - int NExpressionGroup = 105; - int NFunctionCallArgs = 106; - int NNonemptyAbstractDeclarator = 107; - int NInitializer = 108; - int NStatementExpr = 109; - int NEmptyExpression = 110; - int NParameterTypeList = 111; - int NFunctionDef = 112; - int NCompoundStatement = 113; - int NParameterDeclaration = 114; - int NCommaExpr = 115; - int NUnaryExpr = 116; - int NLabel = 117; - int NPostfixExpr = 118; - int NRangeExpr = 119; - int NStringSeq = 120; - int NInitializerElementLabel = 121; - int NLcurlyInitializer = 122; - int NAsmAttribute = 123; - int NGnuAsmExpr = 124; - int NTypeMissing = 125; - int Vocabulary = 126; - int Whitespace = 127; - int Comment = 128; - int CPPComment = 129; - int PREPROC_DIRECTIVE = 130; - int Space = 131; - int LineDirective = 132; - int BadStringLiteral = 133; - int Escape = 134; - int Digit = 135; - int LongSuffix = 136; - int UnsignedSuffix = 137; - int FloatSuffix = 138; - int Exponent = 139; - int Number = 140; - int LITERAL___label__ = 141; - int LITERAL_inline = 142; - int LITERAL_byte = 143; - int LITERAL_boolean = 144; - int LITERAL_Servo = 145; - int LITERAL_Wire = 146; - int LITERAL_typeof = 147; - int LITERAL___complex = 148; - int LITERAL___attribute = 149; - int LITERAL___alignof = 150; - int LITERAL___real = 151; - int LITERAL___imag = 152; -} diff --git a/app/preproc/WTokenTypes.txt b/app/preproc/WTokenTypes.txt deleted file mode 100644 index f6a6bd02d..000000000 --- a/app/preproc/WTokenTypes.txt +++ /dev/null @@ -1,151 +0,0 @@ -// $ANTLR 2.7.2: expandedWParser.g -> WTokenTypes.txt$ -W // output token vocab name -LITERAL_typedef="typedef"=4 -LITERAL_asm="asm"=5 -LITERAL_volatile="volatile"=6 -LCURLY=7 -RCURLY=8 -SEMI=9 -LITERAL_struct="struct"=10 -LITERAL_union="union"=11 -LITERAL_enum="enum"=12 -LITERAL_auto="auto"=13 -LITERAL_register="register"=14 -LITERAL_extern="extern"=15 -LITERAL_static="static"=16 -LITERAL_const="const"=17 -LITERAL_void="void"=18 -LITERAL_char="char"=19 -LITERAL_short="short"=20 -LITERAL_int="int"=21 -LITERAL_long="long"=22 -LITERAL_float="float"=23 -LITERAL_double="double"=24 -LITERAL_signed="signed"=25 -LITERAL_unsigned="unsigned"=26 -ID=27 -COMMA=28 -COLON=29 -ASSIGN=30 -STAR=31 -LPAREN=32 -RPAREN=33 -LBRACKET=34 -RBRACKET=35 -VARARGS=36 -LITERAL_while="while"=37 -LITERAL_do="do"=38 -LITERAL_for="for"=39 -LITERAL_goto="goto"=40 -LITERAL_continue="continue"=41 -LITERAL_break="break"=42 -LITERAL_return="return"=43 -LITERAL_case="case"=44 -LITERAL_default="default"=45 -LITERAL_if="if"=46 -LITERAL_else="else"=47 -LITERAL_switch="switch"=48 -DIV_ASSIGN=49 -PLUS_ASSIGN=50 -MINUS_ASSIGN=51 -STAR_ASSIGN=52 -MOD_ASSIGN=53 -RSHIFT_ASSIGN=54 -LSHIFT_ASSIGN=55 -BAND_ASSIGN=56 -BOR_ASSIGN=57 -BXOR_ASSIGN=58 -QUESTION=59 -LOR=60 -LAND=61 -BOR=62 -BXOR=63 -BAND=64 -EQUAL=65 -NOT_EQUAL=66 -LT=67 -LTE=68 -GT=69 -GTE=70 -LSHIFT=71 -RSHIFT=72 -PLUS=73 -MINUS=74 -DIV=75 -MOD=76 -INC=77 -DEC=78 -LITERAL_sizeof="sizeof"=79 -BNOT=80 -LNOT=81 -PTR=82 -DOT=83 -CharLiteral=84 -StringLiteral=85 -IntOctalConst=86 -LongOctalConst=87 -UnsignedOctalConst=88 -IntIntConst=89 -LongIntConst=90 -UnsignedIntConst=91 -IntHexConst=92 -LongHexConst=93 -UnsignedHexConst=94 -FloatDoubleConst=95 -DoubleDoubleConst=96 -LongDoubleConst=97 -NTypedefName=98 -NInitDecl=99 -NDeclarator=100 -NStructDeclarator=101 -NDeclaration=102 -NCast=103 -NPointerGroup=104 -NExpressionGroup=105 -NFunctionCallArgs=106 -NNonemptyAbstractDeclarator=107 -NInitializer=108 -NStatementExpr=109 -NEmptyExpression=110 -NParameterTypeList=111 -NFunctionDef=112 -NCompoundStatement=113 -NParameterDeclaration=114 -NCommaExpr=115 -NUnaryExpr=116 -NLabel=117 -NPostfixExpr=118 -NRangeExpr=119 -NStringSeq=120 -NInitializerElementLabel=121 -NLcurlyInitializer=122 -NAsmAttribute=123 -NGnuAsmExpr=124 -NTypeMissing=125 -Vocabulary=126 -Whitespace=127 -Comment=128 -CPPComment=129 -PREPROC_DIRECTIVE("a line directive")=130 -Space=131 -LineDirective=132 -BadStringLiteral=133 -Escape=134 -Digit=135 -LongSuffix=136 -UnsignedSuffix=137 -FloatSuffix=138 -Exponent=139 -Number=140 -LITERAL___label__="__label__"=141 -LITERAL_inline="inline"=142 -LITERAL_byte="byte"=143 -LITERAL_boolean="boolean"=144 -LITERAL_Servo="Servo"=145 -LITERAL_Wire="Wire"=146 -LITERAL_typeof="typeof"=147 -LITERAL___complex="__complex"=148 -LITERAL___attribute="__attribute"=149 -LITERAL___alignof="__alignof"=150 -LITERAL___real="__real"=151 -LITERAL___imag="__imag"=152 diff --git a/app/preproc/WTreeParser.g b/app/preproc/WTreeParser.g deleted file mode 100755 index 9d7783707..000000000 --- a/app/preproc/WTreeParser.g +++ /dev/null @@ -1,857 +0,0 @@ -/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - Copyright (c) Non, Inc. 1998 -- All Rights Reserved - -PROJECT: C Compiler -MODULE: WTreeParser -FILE: WTreeParser.g - -AUTHOR: Monty Zukowski (jamz@cdsnet.net) April 28, 1998 -MODIFICATIONS: Hernando Barragan added support for the Wiring language - -DESCRIPTION: - - This tree grammar is for a Gnu C AST. No actions in it, - subclass to do something useful. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ - - -header { -package processing.app.preproc; - -import java.io.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; -} - - -class WTreeParser extends TreeParser; - -options - { - importVocab = W; - buildAST = false; - ASTLabelType = "TNode"; - - // Copied following options from java grammar. - codeGenMakeSwitchThreshold = 2; - codeGenBitsetTestThreshold = 3; - } - - -{ - int traceDepth = 0; - public void reportError(RecognitionException ex) { - if ( ex != null) { - System.err.println("ANTLR Tree Parsing RecognitionException Error: " + ex.getClass().getName() + " " + ex ); - ex.printStackTrace(System.err); - } - } - public void reportError(NoViableAltException ex) { - System.err.println("ANTLR Tree Parsing NoViableAltException Error: " + ex.toString()); - TNode.printTree( ex.node ); - ex.printStackTrace(System.err); - } - public void reportError(MismatchedTokenException ex) { - if ( ex != null) { - TNode.printTree( ex.node ); - System.err.println("ANTLR Tree Parsing MismatchedTokenException Error: " + ex ); - ex.printStackTrace(System.err); - } - } - public void reportError(String s) { - System.err.println("ANTLR Error from String: " + s); - } - public void reportWarning(String s) { - System.err.println("ANTLR Warning from String: " + s); - } - protected void match(AST t, int ttype) throws MismatchedTokenException { - //System.out.println("match("+ttype+"); cursor is "+t); - super.match(t, ttype); - } - public void match(AST t, BitSet b) throws MismatchedTokenException { - //System.out.println("match("+b+"); cursor is "+t); - super.match(t, b); - } - protected void matchNot(AST t, int ttype) throws MismatchedTokenException { - //System.out.println("matchNot("+ttype+"); cursor is "+t); - super.matchNot(t, ttype); - } - public void traceIn(String rname, AST t) { - traceDepth += 1; - for (int x=0; x typeName - | expr - ) - RPAREN - ) - | "__complex" - ; - - -typedefName - : #(NTypedefName ID) - ; - - -structSpecifier - : #( "struct" structOrUnionBody ) - ; - -unionSpecifier - : #( "union" structOrUnionBody ) - ; - -structOrUnionBody - : ( (ID LCURLY) => ID LCURLY - ( structDeclarationList )? - RCURLY - | LCURLY - ( structDeclarationList )? - RCURLY - | ID - ) - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - -structDeclarationList - : ( structDeclaration )+ - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - - -structDeclaration - : specifierQualifierList structDeclaratorList - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - - -specifierQualifierList - : ( - typeSpecifier - | typeQualifier - )+ - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - - -structDeclaratorList - : ( structDeclarator )+ - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - - -structDeclarator - : - #( NStructDeclarator - ( declarator )? - ( COLON expr )? - ( attributeDecl )* - ) - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - - - -enumSpecifier - : #( "enum" - ( ID )? - ( LCURLY enumList RCURLY )? - ) - ; - - -enumList - : ( enumerator )+ - ; - - -enumerator - : ID ( ASSIGN expr )? - ; - - - -attributeDecl: - #( "__attribute" (.)* ) - | #( NAsmAttribute LPAREN expr RPAREN ) - ; - -initDeclList - : ( initDecl )+ - ; - - -initDecl - { String declName = ""; } - : #( NInitDecl - declarator - ( attributeDecl )* - ( ASSIGN initializer - | COLON expr - )? - ) - ; - - -pointerGroup - : #( NPointerGroup ( STAR ( typeQualifier )* )+ ) - ; - - - -idList - : ID ( COMMA ID )* - ; - - - -initializer - : #( NInitializer (initializerElementLabel)? expr ) - | lcurlyInitializer - ; - -initializerElementLabel - : #( NInitializerElementLabel - ( - ( LBRACKET expr RBRACKET (ASSIGN)? ) - | ID COLON - | DOT ID ASSIGN - ) - ) - ; - -lcurlyInitializer - : #( NLcurlyInitializer - initializerList - RCURLY - ) - ; - -initializerList - : ( initializer )* - ; - - -declarator - : #( NDeclarator - ( pointerGroup )? - - ( id:ID - | LPAREN declarator RPAREN - ) - - ( #( NParameterTypeList - ( - parameterTypeList - | (idList)? - ) - RPAREN - ) - | LBRACKET ( expr )? RBRACKET - )* - ) - ; - - - -parameterTypeList - : ( parameterDeclaration ( COMMA | SEMI )? )+ ( VARARGS )? - ; - - - -parameterDeclaration - : #( NParameterDeclaration - declSpecifiers - (declarator | nonemptyAbstractDeclarator)? - ) - ; - - -functionDef - : #( NFunctionDef - ( functionDeclSpecifiers)? - declarator - (declaration | VARARGS)* - compoundStatement - ) - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - -functionDeclSpecifiers - : - ( functionStorageClassSpecifier - | typeQualifier - | typeSpecifier - )+ - ; - -declarationList - : - ( //ANTLR doesn't know that declarationList properly eats all the declarations - //so it warns about the ambiguity - options { - warnWhenFollowAmbig = false; - } : - localLabelDecl - | declaration - )+ - ; - -localLabelDecl - : #("__label__" (ID)+ ) - ; - - - -compoundStatement - : #( NCompoundStatement - ( declarationList - | functionDef - )* - ( statementList )? - RCURLY - ) - ; - -statementList - : ( statement )+ - ; - -statement - : statementBody - ; - -statementBody - : SEMI // Empty statements - - | compoundStatement // Group of statements - - | #(NStatementExpr expr) // Expressions - -// Iteration statements: - - | #( "while" expr statement ) - | #( "do" statement expr ) - | #( "for" - expr expr expr - statement - ) - - -// Jump statements: - - | #( "goto" expr ) - | "continue" - | "break" - | #( "return" ( expr )? ) - - -// Labeled statements: - | #( NLabel ID (statement)? ) - | #( "case" expr (statement)? ) - | #( "default" (statement)? ) - - - -// Selection statements: - - | #( "if" - expr statement - ( "else" statement )? - ) - | #( "switch" expr statement ) - - - - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - - - - - -expr - : assignExpr - | conditionalExpr - | logicalOrExpr - | logicalAndExpr - | inclusiveOrExpr - | exclusiveOrExpr - | bitAndExpr - | equalityExpr - | relationalExpr - | shiftExpr - | additiveExpr - | multExpr - | castExpr - | unaryExpr - | postfixExpr - | primaryExpr - | commaExpr - | emptyExpr - | compoundStatementExpr - | initializer - | rangeExpr - | gnuAsmExpr - ; - -commaExpr - : #(NCommaExpr expr expr) - ; - -emptyExpr - : NEmptyExpression - ; - -compoundStatementExpr - : #(LPAREN compoundStatement RPAREN) - ; - -rangeExpr - : #(NRangeExpr expr VARARGS expr) - ; - -gnuAsmExpr - : #(NGnuAsmExpr - ("volatile")? - LPAREN stringConst - ( options { warnWhenFollowAmbig = false; }: - COLON (strOptExprPair ( COMMA strOptExprPair)* )? - ( options { warnWhenFollowAmbig = false; }: - COLON (strOptExprPair ( COMMA strOptExprPair)* )? - )? - )? - ( COLON stringConst ( COMMA stringConst)* )? - RPAREN - ) - ; - -strOptExprPair - : stringConst ( LPAREN expr RPAREN )? - ; - -assignExpr - : #( ASSIGN expr expr) - | #( DIV_ASSIGN expr expr) - | #( PLUS_ASSIGN expr expr) - | #( MINUS_ASSIGN expr expr) - | #( STAR_ASSIGN expr expr) - | #( MOD_ASSIGN expr expr) - | #( RSHIFT_ASSIGN expr expr) - | #( LSHIFT_ASSIGN expr expr) - | #( BAND_ASSIGN expr expr) - | #( BOR_ASSIGN expr expr) - | #( BXOR_ASSIGN expr expr) - ; - - -conditionalExpr - : #( QUESTION expr (expr)? COLON expr ) - ; - - -logicalOrExpr - : #( LOR expr expr) - ; - - -logicalAndExpr - : #( LAND expr expr ) - ; - - -inclusiveOrExpr - : #( BOR expr expr ) - ; - - -exclusiveOrExpr - : #( BXOR expr expr ) - ; - - -bitAndExpr - : #( BAND expr expr ) - ; - - - -equalityExpr - : #( EQUAL expr expr) - | #( NOT_EQUAL expr expr) - ; - - -relationalExpr - : #( LT expr expr) - | #( LTE expr expr) - | #( GT expr expr) - | #( GTE expr expr) - ; - - - -shiftExpr - : #( LSHIFT expr expr) - | #( RSHIFT expr expr) - ; - - -additiveExpr - : #( PLUS expr expr) - | #( MINUS expr expr) - ; - - -multExpr - : #( STAR expr expr) - | #( DIV expr expr) - | #( MOD expr expr) - ; - - - -castExpr - : #( NCast typeName RPAREN expr) - ; - - -typeName - : specifierQualifierList (nonemptyAbstractDeclarator)? - ; - -nonemptyAbstractDeclarator - : #( NNonemptyAbstractDeclarator - ( pointerGroup - ( (LPAREN - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - RPAREN) - | (LBRACKET (expr)? RBRACKET) - )* - - | ( (LPAREN - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - RPAREN) - | (LBRACKET (expr)? RBRACKET) - )+ - ) - ) - ; - - - -unaryExpr - : #( INC expr ) - | #( DEC expr ) - | #( NUnaryExpr unaryOperator expr) - | #( "sizeof" - ( ( LPAREN typeName )=> LPAREN typeName RPAREN - | expr - ) - ) - | #( "__alignof" - ( ( LPAREN typeName )=> LPAREN typeName RPAREN - | expr - ) - ) - ; -/* -exception -catch [RecognitionException ex] - { - reportError(ex); - System.out.println("PROBLEM TREE:\n" - + _t.toStringList()); - if (_t!=null) {_t = _t.getNextSibling();} - } -*/ - - unaryOperator - : BAND - | STAR - | PLUS - | MINUS - | BNOT - | LNOT - | LAND - | "__real" - | "__imag" - ; - - -postfixExpr - : #( NPostfixExpr - primaryExpr - ( PTR ID - | DOT ID - | #( NFunctionCallArgs (argExprList)? RPAREN ) - | LBRACKET expr RBRACKET - | INC - | DEC - )+ - ) - ; - - - -primaryExpr - : ID - | Number - | charConst - | stringConst - -// JTC: -// ID should catch the enumerator -// leaving it in gives ambiguous err -// | enumerator - - | #( NExpressionGroup expr ) - ; - - - -argExprList - : ( expr )+ - ; - - - -protected -charConst - : CharLiteral - ; - - -protected -stringConst - : #(NStringSeq (StringLiteral)+) - ; - - -protected -intConst - : IntOctalConst - | LongOctalConst - | UnsignedOctalConst - | IntIntConst - | LongIntConst - | UnsignedIntConst - | IntHexConst - | LongHexConst - | UnsignedHexConst - ; - - -protected -floatConst - : FloatDoubleConst - | DoubleDoubleConst - | LongDoubleConst - ; - - - - - - - - - diff --git a/app/preproc/WTreeParser.java b/app/preproc/WTreeParser.java deleted file mode 100644 index b78d48716..000000000 --- a/app/preproc/WTreeParser.java +++ /dev/null @@ -1,5551 +0,0 @@ -// $ANTLR 2.7.2: "WTreeParser.g" -> "WTreeParser.java"$ - -package processing.app.preproc; - -import java.io.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; - -import antlr.TreeParser; -import antlr.Token; -import antlr.collections.AST; -import antlr.RecognitionException; -import antlr.ANTLRException; -import antlr.NoViableAltException; -import antlr.MismatchedTokenException; -import antlr.SemanticException; -import antlr.collections.impl.BitSet; -import antlr.ASTPair; -import antlr.collections.impl.ASTArray; - - -public class WTreeParser extends antlr.TreeParser implements WTreeParserTokenTypes - { - - int traceDepth = 0; - public void reportError(RecognitionException ex) { - if ( ex != null) { - System.err.println("ANTLR Tree Parsing RecognitionException Error: " + ex.getClass().getName() + " " + ex ); - ex.printStackTrace(System.err); - } - } - public void reportError(NoViableAltException ex) { - System.err.println("ANTLR Tree Parsing NoViableAltException Error: " + ex.toString()); - TNode.printTree( ex.node ); - ex.printStackTrace(System.err); - } - public void reportError(MismatchedTokenException ex) { - if ( ex != null) { - TNode.printTree( ex.node ); - System.err.println("ANTLR Tree Parsing MismatchedTokenException Error: " + ex ); - ex.printStackTrace(System.err); - } - } - public void reportError(String s) { - System.err.println("ANTLR Error from String: " + s); - } - public void reportWarning(String s) { - System.err.println("ANTLR Warning from String: " + s); - } - protected void match(AST t, int ttype) throws MismatchedTokenException { - //System.out.println("match("+ttype+"); cursor is "+t); - super.match(t, ttype); - } - public void match(AST t, BitSet b) throws MismatchedTokenException { - //System.out.println("match("+b+"); cursor is "+t); - super.match(t, b); - } - protected void matchNot(AST t, int ttype) throws MismatchedTokenException { - //System.out.println("matchNot("+ttype+"); cursor is "+t); - super.matchNot(t, ttype); - } - public void traceIn(String rname, AST t) { - traceDepth += 1; - for (int x=0; x=1 ) { break _loop5; } else {throw new NoViableAltException(_t);} - } - - _cnt5++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void externalDef(AST _t) throws RecognitionException { - - TNode externalDef_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NDeclaration: - { - declaration(_t); - _t = _retTree; - break; - } - case NFunctionDef: - { - functionDef(_t); - _t = _retTree; - break; - } - case LITERAL_asm: - { - asm_expr(_t); - _t = _retTree; - break; - } - case SEMI: - { - TNode tmp1_AST_in = (TNode)_t; - match(_t,SEMI); - _t = _t.getNextSibling(); - break; - } - case NTypeMissing: - { - typelessDeclaration(_t); - _t = _retTree; - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void declaration(AST _t) throws RecognitionException { - - TNode declaration_AST_in = (TNode)_t; - - try { // for error handling - AST __t15 = _t; - TNode tmp2_AST_in = (TNode)_t; - match(_t,NDeclaration); - _t = _t.getFirstChild(); - declSpecifiers(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NInitDecl: - { - initDeclList(_t); - _t = _retTree; - break; - } - case SEMI: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - { - int _cnt18=0; - _loop18: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==SEMI)) { - TNode tmp3_AST_in = (TNode)_t; - match(_t,SEMI); - _t = _t.getNextSibling(); - } - else { - if ( _cnt18>=1 ) { break _loop18; } else {throw new NoViableAltException(_t);} - } - - _cnt18++; - } while (true); - } - _t = __t15; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void functionDef(AST _t) throws RecognitionException { - - TNode functionDef_AST_in = (TNode)_t; - - try { // for error handling - AST __t125 = _t; - TNode tmp4_AST_in = (TNode)_t; - match(_t,NFunctionDef); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_extern: - case LITERAL_static: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case NTypedefName: - case LITERAL_inline: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - functionDeclSpecifiers(_t); - _t = _retTree; - break; - } - case NDeclarator: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - declarator(_t); - _t = _retTree; - { - _loop128: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NDeclaration: - { - declaration(_t); - _t = _retTree; - break; - } - case VARARGS: - { - TNode tmp5_AST_in = (TNode)_t; - match(_t,VARARGS); - _t = _t.getNextSibling(); - break; - } - default: - { - break _loop128; - } - } - } while (true); - } - compoundStatement(_t); - _t = _retTree; - _t = __t125; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void asm_expr(AST _t) throws RecognitionException { - - TNode asm_expr_AST_in = (TNode)_t; - - try { // for error handling - AST __t10 = _t; - TNode tmp6_AST_in = (TNode)_t; - match(_t,LITERAL_asm); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_volatile: - { - TNode tmp7_AST_in = (TNode)_t; - match(_t,LITERAL_volatile); - _t = _t.getNextSibling(); - break; - } - case LCURLY: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp8_AST_in = (TNode)_t; - match(_t,LCURLY); - _t = _t.getNextSibling(); - expr(_t); - _t = _retTree; - TNode tmp9_AST_in = (TNode)_t; - match(_t,RCURLY); - _t = _t.getNextSibling(); - { - int _cnt13=0; - _loop13: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==SEMI)) { - TNode tmp10_AST_in = (TNode)_t; - match(_t,SEMI); - _t = _t.getNextSibling(); - } - else { - if ( _cnt13>=1 ) { break _loop13; } else {throw new NoViableAltException(_t);} - } - - _cnt13++; - } while (true); - } - _t = __t10; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void typelessDeclaration(AST _t) throws RecognitionException { - - TNode typelessDeclaration_AST_in = (TNode)_t; - - try { // for error handling - AST __t8 = _t; - TNode tmp11_AST_in = (TNode)_t; - match(_t,NTypeMissing); - _t = _t.getFirstChild(); - initDeclList(_t); - _t = _retTree; - TNode tmp12_AST_in = (TNode)_t; - match(_t,SEMI); - _t = _t.getNextSibling(); - _t = __t8; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void initDeclList(AST _t) throws RecognitionException { - - TNode initDeclList_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt78=0; - _loop78: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NInitDecl)) { - initDecl(_t); - _t = _retTree; - } - else { - if ( _cnt78>=1 ) { break _loop78; } else {throw new NoViableAltException(_t);} - } - - _cnt78++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void expr(AST _t) throws RecognitionException { - - TNode expr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ASSIGN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - { - assignExpr(_t); - _t = _retTree; - break; - } - case QUESTION: - { - conditionalExpr(_t); - _t = _retTree; - break; - } - case LOR: - { - logicalOrExpr(_t); - _t = _retTree; - break; - } - case LAND: - { - logicalAndExpr(_t); - _t = _retTree; - break; - } - case BOR: - { - inclusiveOrExpr(_t); - _t = _retTree; - break; - } - case BXOR: - { - exclusiveOrExpr(_t); - _t = _retTree; - break; - } - case BAND: - { - bitAndExpr(_t); - _t = _retTree; - break; - } - case EQUAL: - case NOT_EQUAL: - { - equalityExpr(_t); - _t = _retTree; - break; - } - case LT: - case LTE: - case GT: - case GTE: - { - relationalExpr(_t); - _t = _retTree; - break; - } - case LSHIFT: - case RSHIFT: - { - shiftExpr(_t); - _t = _retTree; - break; - } - case PLUS: - case MINUS: - { - additiveExpr(_t); - _t = _retTree; - break; - } - case STAR: - case DIV: - case MOD: - { - multExpr(_t); - _t = _retTree; - break; - } - case NCast: - { - castExpr(_t); - _t = _retTree; - break; - } - case INC: - case DEC: - case LITERAL_sizeof: - case NUnaryExpr: - case LITERAL___alignof: - { - unaryExpr(_t); - _t = _retTree; - break; - } - case NPostfixExpr: - { - postfixExpr(_t); - _t = _retTree; - break; - } - case ID: - case CharLiteral: - case NExpressionGroup: - case NStringSeq: - case Number: - { - primaryExpr(_t); - _t = _retTree; - break; - } - case NCommaExpr: - { - commaExpr(_t); - _t = _retTree; - break; - } - case NEmptyExpression: - { - emptyExpr(_t); - _t = _retTree; - break; - } - case LPAREN: - { - compoundStatementExpr(_t); - _t = _retTree; - break; - } - case NInitializer: - case NLcurlyInitializer: - { - initializer(_t); - _t = _retTree; - break; - } - case NRangeExpr: - { - rangeExpr(_t); - _t = _retTree; - break; - } - case NGnuAsmExpr: - { - gnuAsmExpr(_t); - _t = _retTree; - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void declSpecifiers(AST _t) throws RecognitionException { - - TNode declSpecifiers_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt21=0; - _loop21: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_typedef: - case LITERAL_auto: - case LITERAL_register: - case LITERAL_extern: - case LITERAL_static: - case LITERAL_inline: - { - storageClassSpecifier(_t); - _t = _retTree; - break; - } - case LITERAL_volatile: - case LITERAL_const: - { - typeQualifier(_t); - _t = _retTree; - break; - } - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case NTypedefName: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - typeSpecifier(_t); - _t = _retTree; - break; - } - default: - { - if ( _cnt21>=1 ) { break _loop21; } else {throw new NoViableAltException(_t);} - } - } - _cnt21++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void storageClassSpecifier(AST _t) throws RecognitionException { - - TNode storageClassSpecifier_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_auto: - { - TNode tmp13_AST_in = (TNode)_t; - match(_t,LITERAL_auto); - _t = _t.getNextSibling(); - break; - } - case LITERAL_register: - { - TNode tmp14_AST_in = (TNode)_t; - match(_t,LITERAL_register); - _t = _t.getNextSibling(); - break; - } - case LITERAL_typedef: - { - TNode tmp15_AST_in = (TNode)_t; - match(_t,LITERAL_typedef); - _t = _t.getNextSibling(); - break; - } - case LITERAL_extern: - case LITERAL_static: - case LITERAL_inline: - { - functionStorageClassSpecifier(_t); - _t = _retTree; - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void typeQualifier(AST _t) throws RecognitionException { - - TNode typeQualifier_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_const: - { - TNode tmp16_AST_in = (TNode)_t; - match(_t,LITERAL_const); - _t = _t.getNextSibling(); - break; - } - case LITERAL_volatile: - { - TNode tmp17_AST_in = (TNode)_t; - match(_t,LITERAL_volatile); - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void typeSpecifier(AST _t) throws RecognitionException { - - TNode typeSpecifier_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_void: - { - TNode tmp18_AST_in = (TNode)_t; - match(_t,LITERAL_void); - _t = _t.getNextSibling(); - break; - } - case LITERAL_char: - { - TNode tmp19_AST_in = (TNode)_t; - match(_t,LITERAL_char); - _t = _t.getNextSibling(); - break; - } - case LITERAL_short: - { - TNode tmp20_AST_in = (TNode)_t; - match(_t,LITERAL_short); - _t = _t.getNextSibling(); - break; - } - case LITERAL_int: - { - TNode tmp21_AST_in = (TNode)_t; - match(_t,LITERAL_int); - _t = _t.getNextSibling(); - break; - } - case LITERAL_long: - { - TNode tmp22_AST_in = (TNode)_t; - match(_t,LITERAL_long); - _t = _t.getNextSibling(); - break; - } - case LITERAL_float: - { - TNode tmp23_AST_in = (TNode)_t; - match(_t,LITERAL_float); - _t = _t.getNextSibling(); - break; - } - case LITERAL_double: - { - TNode tmp24_AST_in = (TNode)_t; - match(_t,LITERAL_double); - _t = _t.getNextSibling(); - break; - } - case LITERAL_signed: - { - TNode tmp25_AST_in = (TNode)_t; - match(_t,LITERAL_signed); - _t = _t.getNextSibling(); - break; - } - case LITERAL_unsigned: - { - TNode tmp26_AST_in = (TNode)_t; - match(_t,LITERAL_unsigned); - _t = _t.getNextSibling(); - break; - } - case LITERAL_byte: - { - TNode tmp27_AST_in = (TNode)_t; - match(_t,LITERAL_byte); - _t = _t.getNextSibling(); - break; - } - case LITERAL_boolean: - { - TNode tmp28_AST_in = (TNode)_t; - match(_t,LITERAL_boolean); - _t = _t.getNextSibling(); - break; - } - case LITERAL_Servo: - { - TNode tmp29_AST_in = (TNode)_t; - match(_t,LITERAL_Servo); - _t = _t.getNextSibling(); - break; - } - case LITERAL_Wire: - { - TNode tmp30_AST_in = (TNode)_t; - match(_t,LITERAL_Wire); - _t = _t.getNextSibling(); - break; - } - case LITERAL_struct: - { - structSpecifier(_t); - _t = _retTree; - { - _loop27: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NAsmAttribute||_t.getType()==LITERAL___attribute)) { - attributeDecl(_t); - _t = _retTree; - } - else { - break _loop27; - } - - } while (true); - } - break; - } - case LITERAL_union: - { - unionSpecifier(_t); - _t = _retTree; - { - _loop29: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NAsmAttribute||_t.getType()==LITERAL___attribute)) { - attributeDecl(_t); - _t = _retTree; - } - else { - break _loop29; - } - - } while (true); - } - break; - } - case LITERAL_enum: - { - enumSpecifier(_t); - _t = _retTree; - break; - } - case NTypedefName: - { - typedefName(_t); - _t = _retTree; - break; - } - case LITERAL_typeof: - { - AST __t30 = _t; - TNode tmp31_AST_in = (TNode)_t; - match(_t,LITERAL_typeof); - _t = _t.getFirstChild(); - TNode tmp32_AST_in = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case NTypedefName: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - typeName(_t); - _t = _retTree; - break; - } - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - expr(_t); - _t = _retTree; - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp33_AST_in = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - _t = __t30; - _t = _t.getNextSibling(); - break; - } - case LITERAL___complex: - { - TNode tmp34_AST_in = (TNode)_t; - match(_t,LITERAL___complex); - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void functionStorageClassSpecifier(AST _t) throws RecognitionException { - - TNode functionStorageClassSpecifier_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_extern: - { - TNode tmp35_AST_in = (TNode)_t; - match(_t,LITERAL_extern); - _t = _t.getNextSibling(); - break; - } - case LITERAL_static: - { - TNode tmp36_AST_in = (TNode)_t; - match(_t,LITERAL_static); - _t = _t.getNextSibling(); - break; - } - case LITERAL_inline: - { - TNode tmp37_AST_in = (TNode)_t; - match(_t,LITERAL_inline); - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void structSpecifier(AST _t) throws RecognitionException { - - TNode structSpecifier_AST_in = (TNode)_t; - - try { // for error handling - AST __t37 = _t; - TNode tmp38_AST_in = (TNode)_t; - match(_t,LITERAL_struct); - _t = _t.getFirstChild(); - structOrUnionBody(_t); - _t = _retTree; - _t = __t37; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void attributeDecl(AST _t) throws RecognitionException { - - TNode attributeDecl_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL___attribute: - { - AST __t72 = _t; - TNode tmp39_AST_in = (TNode)_t; - match(_t,LITERAL___attribute); - _t = _t.getFirstChild(); - { - _loop74: - do { - if (_t==null) _t=ASTNULL; - if (((_t.getType() >= LITERAL_typedef && _t.getType() <= LITERAL___imag))) { - TNode tmp40_AST_in = (TNode)_t; - if ( _t==null ) throw new MismatchedTokenException(); - _t = _t.getNextSibling(); - } - else { - break _loop74; - } - - } while (true); - } - _t = __t72; - _t = _t.getNextSibling(); - break; - } - case NAsmAttribute: - { - AST __t75 = _t; - TNode tmp41_AST_in = (TNode)_t; - match(_t,NAsmAttribute); - _t = _t.getFirstChild(); - TNode tmp42_AST_in = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - expr(_t); - _t = _retTree; - TNode tmp43_AST_in = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - _t = __t75; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void unionSpecifier(AST _t) throws RecognitionException { - - TNode unionSpecifier_AST_in = (TNode)_t; - - try { // for error handling - AST __t39 = _t; - TNode tmp44_AST_in = (TNode)_t; - match(_t,LITERAL_union); - _t = _t.getFirstChild(); - structOrUnionBody(_t); - _t = _retTree; - _t = __t39; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void enumSpecifier(AST _t) throws RecognitionException { - - TNode enumSpecifier_AST_in = (TNode)_t; - - try { // for error handling - AST __t63 = _t; - TNode tmp45_AST_in = (TNode)_t; - match(_t,LITERAL_enum); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - { - TNode tmp46_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - break; - } - case 3: - case LCURLY: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LCURLY: - { - TNode tmp47_AST_in = (TNode)_t; - match(_t,LCURLY); - _t = _t.getNextSibling(); - enumList(_t); - _t = _retTree; - TNode tmp48_AST_in = (TNode)_t; - match(_t,RCURLY); - _t = _t.getNextSibling(); - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t63; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void typedefName(AST _t) throws RecognitionException { - - TNode typedefName_AST_in = (TNode)_t; - - try { // for error handling - AST __t35 = _t; - TNode tmp49_AST_in = (TNode)_t; - match(_t,NTypedefName); - _t = _t.getFirstChild(); - TNode tmp50_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - _t = __t35; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void typeName(AST _t) throws RecognitionException { - - TNode typeName_AST_in = (TNode)_t; - - try { // for error handling - specifierQualifierList(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NNonemptyAbstractDeclarator: - { - nonemptyAbstractDeclarator(_t); - _t = _retTree; - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void structOrUnionBody(AST _t) throws RecognitionException { - - TNode structOrUnionBody_AST_in = (TNode)_t; - - try { // for error handling - { - boolean synPredMatched43 = false; - if (((_t.getType()==ID))) { - AST __t43 = _t; - synPredMatched43 = true; - inputState.guessing++; - try { - { - TNode tmp51_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - TNode tmp52_AST_in = (TNode)_t; - match(_t,LCURLY); - _t = _t.getNextSibling(); - } - } - catch (RecognitionException pe) { - synPredMatched43 = false; - } - _t = __t43; - inputState.guessing--; - } - if ( synPredMatched43 ) { - TNode tmp53_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - TNode tmp54_AST_in = (TNode)_t; - match(_t,LCURLY); - _t = _t.getNextSibling(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case NTypedefName: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - structDeclarationList(_t); - _t = _retTree; - break; - } - case RCURLY: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp55_AST_in = (TNode)_t; - match(_t,RCURLY); - _t = _t.getNextSibling(); - } - else if ((_t.getType()==LCURLY)) { - TNode tmp56_AST_in = (TNode)_t; - match(_t,LCURLY); - _t = _t.getNextSibling(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_volatile: - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_const: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case NTypedefName: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - structDeclarationList(_t); - _t = _retTree; - break; - } - case RCURLY: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp57_AST_in = (TNode)_t; - match(_t,RCURLY); - _t = _t.getNextSibling(); - } - else if ((_t.getType()==ID)) { - TNode tmp58_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - } - else { - throw new NoViableAltException(_t); - } - - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void structDeclarationList(AST _t) throws RecognitionException { - - TNode structDeclarationList_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt48=0; - _loop48: - do { - if (_t==null) _t=ASTNULL; - if ((_tokenSet_1.member(_t.getType()))) { - structDeclaration(_t); - _t = _retTree; - } - else { - if ( _cnt48>=1 ) { break _loop48; } else {throw new NoViableAltException(_t);} - } - - _cnt48++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void structDeclaration(AST _t) throws RecognitionException { - - TNode structDeclaration_AST_in = (TNode)_t; - - try { // for error handling - specifierQualifierList(_t); - _t = _retTree; - structDeclaratorList(_t); - _t = _retTree; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void specifierQualifierList(AST _t) throws RecognitionException { - - TNode specifierQualifierList_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt52=0; - _loop52: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case NTypedefName: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - typeSpecifier(_t); - _t = _retTree; - break; - } - case LITERAL_volatile: - case LITERAL_const: - { - typeQualifier(_t); - _t = _retTree; - break; - } - default: - { - if ( _cnt52>=1 ) { break _loop52; } else {throw new NoViableAltException(_t);} - } - } - _cnt52++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void structDeclaratorList(AST _t) throws RecognitionException { - - TNode structDeclaratorList_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt55=0; - _loop55: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NStructDeclarator)) { - structDeclarator(_t); - _t = _retTree; - } - else { - if ( _cnt55>=1 ) { break _loop55; } else {throw new NoViableAltException(_t);} - } - - _cnt55++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void structDeclarator(AST _t) throws RecognitionException { - - TNode structDeclarator_AST_in = (TNode)_t; - - try { // for error handling - AST __t57 = _t; - TNode tmp59_AST_in = (TNode)_t; - match(_t,NStructDeclarator); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NDeclarator: - { - declarator(_t); - _t = _retTree; - break; - } - case 3: - case COLON: - case NAsmAttribute: - case LITERAL___attribute: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case COLON: - { - TNode tmp60_AST_in = (TNode)_t; - match(_t,COLON); - _t = _t.getNextSibling(); - expr(_t); - _t = _retTree; - break; - } - case 3: - case NAsmAttribute: - case LITERAL___attribute: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - { - _loop61: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NAsmAttribute||_t.getType()==LITERAL___attribute)) { - attributeDecl(_t); - _t = _retTree; - } - else { - break _loop61; - } - - } while (true); - } - _t = __t57; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void declarator(AST _t) throws RecognitionException { - - TNode declarator_AST_in = (TNode)_t; - TNode id = null; - - try { // for error handling - AST __t107 = _t; - TNode tmp61_AST_in = (TNode)_t; - match(_t,NDeclarator); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NPointerGroup: - { - pointerGroup(_t); - _t = _retTree; - break; - } - case ID: - case LPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - { - id = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - break; - } - case LPAREN: - { - TNode tmp62_AST_in = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - declarator(_t); - _t = _retTree; - TNode tmp63_AST_in = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - { - _loop115: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NParameterTypeList: - { - AST __t111 = _t; - TNode tmp64_AST_in = (TNode)_t; - match(_t,NParameterTypeList); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NParameterDeclaration: - { - parameterTypeList(_t); - _t = _retTree; - break; - } - case ID: - case RPAREN: - { - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - { - idList(_t); - _t = _retTree; - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp65_AST_in = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - _t = __t111; - _t = _t.getNextSibling(); - break; - } - case LBRACKET: - { - TNode tmp66_AST_in = (TNode)_t; - match(_t,LBRACKET); - _t = _t.getNextSibling(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - expr(_t); - _t = _retTree; - break; - } - case RBRACKET: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp67_AST_in = (TNode)_t; - match(_t,RBRACKET); - _t = _t.getNextSibling(); - break; - } - default: - { - break _loop115; - } - } - } while (true); - } - _t = __t107; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void enumList(AST _t) throws RecognitionException { - - TNode enumList_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt68=0; - _loop68: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==ID)) { - enumerator(_t); - _t = _retTree; - } - else { - if ( _cnt68>=1 ) { break _loop68; } else {throw new NoViableAltException(_t);} - } - - _cnt68++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void enumerator(AST _t) throws RecognitionException { - - TNode enumerator_AST_in = (TNode)_t; - - try { // for error handling - TNode tmp68_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ASSIGN: - { - TNode tmp69_AST_in = (TNode)_t; - match(_t,ASSIGN); - _t = _t.getNextSibling(); - expr(_t); - _t = _retTree; - break; - } - case RCURLY: - case ID: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void initDecl(AST _t) throws RecognitionException { - - TNode initDecl_AST_in = (TNode)_t; - String declName = ""; - - try { // for error handling - AST __t80 = _t; - TNode tmp70_AST_in = (TNode)_t; - match(_t,NInitDecl); - _t = _t.getFirstChild(); - declarator(_t); - _t = _retTree; - { - _loop82: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NAsmAttribute||_t.getType()==LITERAL___attribute)) { - attributeDecl(_t); - _t = _retTree; - } - else { - break _loop82; - } - - } while (true); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ASSIGN: - { - TNode tmp71_AST_in = (TNode)_t; - match(_t,ASSIGN); - _t = _t.getNextSibling(); - initializer(_t); - _t = _retTree; - break; - } - case COLON: - { - TNode tmp72_AST_in = (TNode)_t; - match(_t,COLON); - _t = _t.getNextSibling(); - expr(_t); - _t = _retTree; - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t80; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void initializer(AST _t) throws RecognitionException { - - TNode initializer_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NInitializer: - { - AST __t94 = _t; - TNode tmp73_AST_in = (TNode)_t; - match(_t,NInitializer); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NInitializerElementLabel: - { - initializerElementLabel(_t); - _t = _retTree; - break; - } - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - expr(_t); - _t = _retTree; - _t = __t94; - _t = _t.getNextSibling(); - break; - } - case NLcurlyInitializer: - { - lcurlyInitializer(_t); - _t = _retTree; - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void pointerGroup(AST _t) throws RecognitionException { - - TNode pointerGroup_AST_in = (TNode)_t; - - try { // for error handling - AST __t85 = _t; - TNode tmp74_AST_in = (TNode)_t; - match(_t,NPointerGroup); - _t = _t.getFirstChild(); - { - int _cnt89=0; - _loop89: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==STAR)) { - TNode tmp75_AST_in = (TNode)_t; - match(_t,STAR); - _t = _t.getNextSibling(); - { - _loop88: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==LITERAL_volatile||_t.getType()==LITERAL_const)) { - typeQualifier(_t); - _t = _retTree; - } - else { - break _loop88; - } - - } while (true); - } - } - else { - if ( _cnt89>=1 ) { break _loop89; } else {throw new NoViableAltException(_t);} - } - - _cnt89++; - } while (true); - } - _t = __t85; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void idList(AST _t) throws RecognitionException { - - TNode idList_AST_in = (TNode)_t; - - try { // for error handling - TNode tmp76_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - { - _loop92: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==COMMA)) { - TNode tmp77_AST_in = (TNode)_t; - match(_t,COMMA); - _t = _t.getNextSibling(); - TNode tmp78_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - } - else { - break _loop92; - } - - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void initializerElementLabel(AST _t) throws RecognitionException { - - TNode initializerElementLabel_AST_in = (TNode)_t; - - try { // for error handling - AST __t97 = _t; - TNode tmp79_AST_in = (TNode)_t; - match(_t,NInitializerElementLabel); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LBRACKET: - { - { - TNode tmp80_AST_in = (TNode)_t; - match(_t,LBRACKET); - _t = _t.getNextSibling(); - expr(_t); - _t = _retTree; - TNode tmp81_AST_in = (TNode)_t; - match(_t,RBRACKET); - _t = _t.getNextSibling(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ASSIGN: - { - TNode tmp82_AST_in = (TNode)_t; - match(_t,ASSIGN); - _t = _t.getNextSibling(); - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - } - break; - } - case ID: - { - TNode tmp83_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - TNode tmp84_AST_in = (TNode)_t; - match(_t,COLON); - _t = _t.getNextSibling(); - break; - } - case DOT: - { - TNode tmp85_AST_in = (TNode)_t; - match(_t,DOT); - _t = _t.getNextSibling(); - TNode tmp86_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - TNode tmp87_AST_in = (TNode)_t; - match(_t,ASSIGN); - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t97; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void lcurlyInitializer(AST _t) throws RecognitionException { - - TNode lcurlyInitializer_AST_in = (TNode)_t; - - try { // for error handling - AST __t102 = _t; - TNode tmp88_AST_in = (TNode)_t; - match(_t,NLcurlyInitializer); - _t = _t.getFirstChild(); - initializerList(_t); - _t = _retTree; - TNode tmp89_AST_in = (TNode)_t; - match(_t,RCURLY); - _t = _t.getNextSibling(); - _t = __t102; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void initializerList(AST _t) throws RecognitionException { - - TNode initializerList_AST_in = (TNode)_t; - - try { // for error handling - { - _loop105: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NInitializer||_t.getType()==NLcurlyInitializer)) { - initializer(_t); - _t = _retTree; - } - else { - break _loop105; - } - - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void parameterTypeList(AST _t) throws RecognitionException { - - TNode parameterTypeList_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt119=0; - _loop119: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==NParameterDeclaration)) { - parameterDeclaration(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case COMMA: - { - TNode tmp90_AST_in = (TNode)_t; - match(_t,COMMA); - _t = _t.getNextSibling(); - break; - } - case SEMI: - { - TNode tmp91_AST_in = (TNode)_t; - match(_t,SEMI); - _t = _t.getNextSibling(); - break; - } - case RPAREN: - case VARARGS: - case NParameterDeclaration: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - } - else { - if ( _cnt119>=1 ) { break _loop119; } else {throw new NoViableAltException(_t);} - } - - _cnt119++; - } while (true); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case VARARGS: - { - TNode tmp92_AST_in = (TNode)_t; - match(_t,VARARGS); - _t = _t.getNextSibling(); - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void parameterDeclaration(AST _t) throws RecognitionException { - - TNode parameterDeclaration_AST_in = (TNode)_t; - - try { // for error handling - AST __t122 = _t; - TNode tmp93_AST_in = (TNode)_t; - match(_t,NParameterDeclaration); - _t = _t.getFirstChild(); - declSpecifiers(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NDeclarator: - { - declarator(_t); - _t = _retTree; - break; - } - case NNonemptyAbstractDeclarator: - { - nonemptyAbstractDeclarator(_t); - _t = _retTree; - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t122; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void nonemptyAbstractDeclarator(AST _t) throws RecognitionException { - - TNode nonemptyAbstractDeclarator_AST_in = (TNode)_t; - - try { // for error handling - AST __t237 = _t; - TNode tmp94_AST_in = (TNode)_t; - match(_t,NNonemptyAbstractDeclarator); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NPointerGroup: - { - pointerGroup(_t); - _t = _retTree; - { - _loop244: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LPAREN: - { - { - TNode tmp95_AST_in = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NNonemptyAbstractDeclarator: - { - nonemptyAbstractDeclarator(_t); - _t = _retTree; - break; - } - case NParameterDeclaration: - { - parameterTypeList(_t); - _t = _retTree; - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp96_AST_in = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - } - break; - } - case LBRACKET: - { - { - TNode tmp97_AST_in = (TNode)_t; - match(_t,LBRACKET); - _t = _t.getNextSibling(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - expr(_t); - _t = _retTree; - break; - } - case RBRACKET: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp98_AST_in = (TNode)_t; - match(_t,RBRACKET); - _t = _t.getNextSibling(); - } - break; - } - default: - { - break _loop244; - } - } - } while (true); - } - break; - } - case LPAREN: - case LBRACKET: - { - { - int _cnt250=0; - _loop250: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LPAREN: - { - { - TNode tmp99_AST_in = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NNonemptyAbstractDeclarator: - { - nonemptyAbstractDeclarator(_t); - _t = _retTree; - break; - } - case NParameterDeclaration: - { - parameterTypeList(_t); - _t = _retTree; - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp100_AST_in = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - } - break; - } - case LBRACKET: - { - { - TNode tmp101_AST_in = (TNode)_t; - match(_t,LBRACKET); - _t = _t.getNextSibling(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - expr(_t); - _t = _retTree; - break; - } - case RBRACKET: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp102_AST_in = (TNode)_t; - match(_t,RBRACKET); - _t = _t.getNextSibling(); - } - break; - } - default: - { - if ( _cnt250>=1 ) { break _loop250; } else {throw new NoViableAltException(_t);} - } - } - _cnt250++; - } while (true); - } - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t237; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void functionDeclSpecifiers(AST _t) throws RecognitionException { - - TNode functionDeclSpecifiers_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt131=0; - _loop131: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_extern: - case LITERAL_static: - case LITERAL_inline: - { - functionStorageClassSpecifier(_t); - _t = _retTree; - break; - } - case LITERAL_volatile: - case LITERAL_const: - { - typeQualifier(_t); - _t = _retTree; - break; - } - case LITERAL_struct: - case LITERAL_union: - case LITERAL_enum: - case LITERAL_void: - case LITERAL_char: - case LITERAL_short: - case LITERAL_int: - case LITERAL_long: - case LITERAL_float: - case LITERAL_double: - case LITERAL_signed: - case LITERAL_unsigned: - case NTypedefName: - case LITERAL_byte: - case LITERAL_boolean: - case LITERAL_Servo: - case LITERAL_Wire: - case LITERAL_typeof: - case LITERAL___complex: - { - typeSpecifier(_t); - _t = _retTree; - break; - } - default: - { - if ( _cnt131>=1 ) { break _loop131; } else {throw new NoViableAltException(_t);} - } - } - _cnt131++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void compoundStatement(AST _t) throws RecognitionException { - - TNode compoundStatement_AST_in = (TNode)_t; - - try { // for error handling - AST __t140 = _t; - TNode tmp103_AST_in = (TNode)_t; - match(_t,NCompoundStatement); - _t = _t.getFirstChild(); - { - _loop142: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NDeclaration: - case LITERAL___label__: - { - declarationList(_t); - _t = _retTree; - break; - } - case NFunctionDef: - { - functionDef(_t); - _t = _retTree; - break; - } - default: - { - break _loop142; - } - } - } while (true); - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case SEMI: - case LITERAL_while: - case LITERAL_do: - case LITERAL_for: - case LITERAL_goto: - case LITERAL_continue: - case LITERAL_break: - case LITERAL_return: - case LITERAL_case: - case LITERAL_default: - case LITERAL_if: - case LITERAL_switch: - case NStatementExpr: - case NCompoundStatement: - case NLabel: - { - statementList(_t); - _t = _retTree; - break; - } - case RCURLY: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp104_AST_in = (TNode)_t; - match(_t,RCURLY); - _t = _t.getNextSibling(); - _t = __t140; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void declarationList(AST _t) throws RecognitionException { - - TNode declarationList_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt134=0; - _loop134: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==LITERAL___label__)) { - localLabelDecl(_t); - _t = _retTree; - } - else if ((_t.getType()==NDeclaration)) { - declaration(_t); - _t = _retTree; - } - else { - if ( _cnt134>=1 ) { break _loop134; } else {throw new NoViableAltException(_t);} - } - - _cnt134++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void localLabelDecl(AST _t) throws RecognitionException { - - TNode localLabelDecl_AST_in = (TNode)_t; - - try { // for error handling - AST __t136 = _t; - TNode tmp105_AST_in = (TNode)_t; - match(_t,LITERAL___label__); - _t = _t.getFirstChild(); - { - int _cnt138=0; - _loop138: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==ID)) { - TNode tmp106_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - } - else { - if ( _cnt138>=1 ) { break _loop138; } else {throw new NoViableAltException(_t);} - } - - _cnt138++; - } while (true); - } - _t = __t136; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void statementList(AST _t) throws RecognitionException { - - TNode statementList_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt146=0; - _loop146: - do { - if (_t==null) _t=ASTNULL; - if ((_tokenSet_2.member(_t.getType()))) { - statement(_t); - _t = _retTree; - } - else { - if ( _cnt146>=1 ) { break _loop146; } else {throw new NoViableAltException(_t);} - } - - _cnt146++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void statement(AST _t) throws RecognitionException { - - TNode statement_AST_in = (TNode)_t; - - try { // for error handling - statementBody(_t); - _t = _retTree; - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void statementBody(AST _t) throws RecognitionException { - - TNode statementBody_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case SEMI: - { - TNode tmp107_AST_in = (TNode)_t; - match(_t,SEMI); - _t = _t.getNextSibling(); - break; - } - case NCompoundStatement: - { - compoundStatement(_t); - _t = _retTree; - break; - } - case NStatementExpr: - { - AST __t149 = _t; - TNode tmp108_AST_in = (TNode)_t; - match(_t,NStatementExpr); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - _t = __t149; - _t = _t.getNextSibling(); - break; - } - case LITERAL_while: - { - AST __t150 = _t; - TNode tmp109_AST_in = (TNode)_t; - match(_t,LITERAL_while); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - statement(_t); - _t = _retTree; - _t = __t150; - _t = _t.getNextSibling(); - break; - } - case LITERAL_do: - { - AST __t151 = _t; - TNode tmp110_AST_in = (TNode)_t; - match(_t,LITERAL_do); - _t = _t.getFirstChild(); - statement(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t151; - _t = _t.getNextSibling(); - break; - } - case LITERAL_for: - { - AST __t152 = _t; - TNode tmp111_AST_in = (TNode)_t; - match(_t,LITERAL_for); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - statement(_t); - _t = _retTree; - _t = __t152; - _t = _t.getNextSibling(); - break; - } - case LITERAL_goto: - { - AST __t153 = _t; - TNode tmp112_AST_in = (TNode)_t; - match(_t,LITERAL_goto); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - _t = __t153; - _t = _t.getNextSibling(); - break; - } - case LITERAL_continue: - { - TNode tmp113_AST_in = (TNode)_t; - match(_t,LITERAL_continue); - _t = _t.getNextSibling(); - break; - } - case LITERAL_break: - { - TNode tmp114_AST_in = (TNode)_t; - match(_t,LITERAL_break); - _t = _t.getNextSibling(); - break; - } - case LITERAL_return: - { - AST __t154 = _t; - TNode tmp115_AST_in = (TNode)_t; - match(_t,LITERAL_return); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - expr(_t); - _t = _retTree; - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t154; - _t = _t.getNextSibling(); - break; - } - case NLabel: - { - AST __t156 = _t; - TNode tmp116_AST_in = (TNode)_t; - match(_t,NLabel); - _t = _t.getFirstChild(); - TNode tmp117_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case SEMI: - case LITERAL_while: - case LITERAL_do: - case LITERAL_for: - case LITERAL_goto: - case LITERAL_continue: - case LITERAL_break: - case LITERAL_return: - case LITERAL_case: - case LITERAL_default: - case LITERAL_if: - case LITERAL_switch: - case NStatementExpr: - case NCompoundStatement: - case NLabel: - { - statement(_t); - _t = _retTree; - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t156; - _t = _t.getNextSibling(); - break; - } - case LITERAL_case: - { - AST __t158 = _t; - TNode tmp118_AST_in = (TNode)_t; - match(_t,LITERAL_case); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case SEMI: - case LITERAL_while: - case LITERAL_do: - case LITERAL_for: - case LITERAL_goto: - case LITERAL_continue: - case LITERAL_break: - case LITERAL_return: - case LITERAL_case: - case LITERAL_default: - case LITERAL_if: - case LITERAL_switch: - case NStatementExpr: - case NCompoundStatement: - case NLabel: - { - statement(_t); - _t = _retTree; - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t158; - _t = _t.getNextSibling(); - break; - } - case LITERAL_default: - { - AST __t160 = _t; - TNode tmp119_AST_in = (TNode)_t; - match(_t,LITERAL_default); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case SEMI: - case LITERAL_while: - case LITERAL_do: - case LITERAL_for: - case LITERAL_goto: - case LITERAL_continue: - case LITERAL_break: - case LITERAL_return: - case LITERAL_case: - case LITERAL_default: - case LITERAL_if: - case LITERAL_switch: - case NStatementExpr: - case NCompoundStatement: - case NLabel: - { - statement(_t); - _t = _retTree; - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t160; - _t = _t.getNextSibling(); - break; - } - case LITERAL_if: - { - AST __t162 = _t; - TNode tmp120_AST_in = (TNode)_t; - match(_t,LITERAL_if); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - statement(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_else: - { - TNode tmp121_AST_in = (TNode)_t; - match(_t,LITERAL_else); - _t = _t.getNextSibling(); - statement(_t); - _t = _retTree; - break; - } - case 3: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - _t = __t162; - _t = _t.getNextSibling(); - break; - } - case LITERAL_switch: - { - AST __t164 = _t; - TNode tmp122_AST_in = (TNode)_t; - match(_t,LITERAL_switch); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - statement(_t); - _t = _retTree; - _t = __t164; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void assignExpr(AST _t) throws RecognitionException { - - TNode assignExpr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ASSIGN: - { - AST __t190 = _t; - TNode tmp123_AST_in = (TNode)_t; - match(_t,ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t190; - _t = _t.getNextSibling(); - break; - } - case DIV_ASSIGN: - { - AST __t191 = _t; - TNode tmp124_AST_in = (TNode)_t; - match(_t,DIV_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t191; - _t = _t.getNextSibling(); - break; - } - case PLUS_ASSIGN: - { - AST __t192 = _t; - TNode tmp125_AST_in = (TNode)_t; - match(_t,PLUS_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t192; - _t = _t.getNextSibling(); - break; - } - case MINUS_ASSIGN: - { - AST __t193 = _t; - TNode tmp126_AST_in = (TNode)_t; - match(_t,MINUS_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t193; - _t = _t.getNextSibling(); - break; - } - case STAR_ASSIGN: - { - AST __t194 = _t; - TNode tmp127_AST_in = (TNode)_t; - match(_t,STAR_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t194; - _t = _t.getNextSibling(); - break; - } - case MOD_ASSIGN: - { - AST __t195 = _t; - TNode tmp128_AST_in = (TNode)_t; - match(_t,MOD_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t195; - _t = _t.getNextSibling(); - break; - } - case RSHIFT_ASSIGN: - { - AST __t196 = _t; - TNode tmp129_AST_in = (TNode)_t; - match(_t,RSHIFT_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t196; - _t = _t.getNextSibling(); - break; - } - case LSHIFT_ASSIGN: - { - AST __t197 = _t; - TNode tmp130_AST_in = (TNode)_t; - match(_t,LSHIFT_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t197; - _t = _t.getNextSibling(); - break; - } - case BAND_ASSIGN: - { - AST __t198 = _t; - TNode tmp131_AST_in = (TNode)_t; - match(_t,BAND_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t198; - _t = _t.getNextSibling(); - break; - } - case BOR_ASSIGN: - { - AST __t199 = _t; - TNode tmp132_AST_in = (TNode)_t; - match(_t,BOR_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t199; - _t = _t.getNextSibling(); - break; - } - case BXOR_ASSIGN: - { - AST __t200 = _t; - TNode tmp133_AST_in = (TNode)_t; - match(_t,BXOR_ASSIGN); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t200; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void conditionalExpr(AST _t) throws RecognitionException { - - TNode conditionalExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t202 = _t; - TNode tmp134_AST_in = (TNode)_t; - match(_t,QUESTION); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - expr(_t); - _t = _retTree; - break; - } - case COLON: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp135_AST_in = (TNode)_t; - match(_t,COLON); - _t = _t.getNextSibling(); - expr(_t); - _t = _retTree; - _t = __t202; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void logicalOrExpr(AST _t) throws RecognitionException { - - TNode logicalOrExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t205 = _t; - TNode tmp136_AST_in = (TNode)_t; - match(_t,LOR); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t205; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void logicalAndExpr(AST _t) throws RecognitionException { - - TNode logicalAndExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t207 = _t; - TNode tmp137_AST_in = (TNode)_t; - match(_t,LAND); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t207; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void inclusiveOrExpr(AST _t) throws RecognitionException { - - TNode inclusiveOrExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t209 = _t; - TNode tmp138_AST_in = (TNode)_t; - match(_t,BOR); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t209; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void exclusiveOrExpr(AST _t) throws RecognitionException { - - TNode exclusiveOrExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t211 = _t; - TNode tmp139_AST_in = (TNode)_t; - match(_t,BXOR); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t211; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void bitAndExpr(AST _t) throws RecognitionException { - - TNode bitAndExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t213 = _t; - TNode tmp140_AST_in = (TNode)_t; - match(_t,BAND); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t213; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void equalityExpr(AST _t) throws RecognitionException { - - TNode equalityExpr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case EQUAL: - { - AST __t215 = _t; - TNode tmp141_AST_in = (TNode)_t; - match(_t,EQUAL); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t215; - _t = _t.getNextSibling(); - break; - } - case NOT_EQUAL: - { - AST __t216 = _t; - TNode tmp142_AST_in = (TNode)_t; - match(_t,NOT_EQUAL); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t216; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void relationalExpr(AST _t) throws RecognitionException { - - TNode relationalExpr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LT: - { - AST __t218 = _t; - TNode tmp143_AST_in = (TNode)_t; - match(_t,LT); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t218; - _t = _t.getNextSibling(); - break; - } - case LTE: - { - AST __t219 = _t; - TNode tmp144_AST_in = (TNode)_t; - match(_t,LTE); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t219; - _t = _t.getNextSibling(); - break; - } - case GT: - { - AST __t220 = _t; - TNode tmp145_AST_in = (TNode)_t; - match(_t,GT); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t220; - _t = _t.getNextSibling(); - break; - } - case GTE: - { - AST __t221 = _t; - TNode tmp146_AST_in = (TNode)_t; - match(_t,GTE); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t221; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void shiftExpr(AST _t) throws RecognitionException { - - TNode shiftExpr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LSHIFT: - { - AST __t223 = _t; - TNode tmp147_AST_in = (TNode)_t; - match(_t,LSHIFT); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t223; - _t = _t.getNextSibling(); - break; - } - case RSHIFT: - { - AST __t224 = _t; - TNode tmp148_AST_in = (TNode)_t; - match(_t,RSHIFT); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t224; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void additiveExpr(AST _t) throws RecognitionException { - - TNode additiveExpr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case PLUS: - { - AST __t226 = _t; - TNode tmp149_AST_in = (TNode)_t; - match(_t,PLUS); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t226; - _t = _t.getNextSibling(); - break; - } - case MINUS: - { - AST __t227 = _t; - TNode tmp150_AST_in = (TNode)_t; - match(_t,MINUS); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t227; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void multExpr(AST _t) throws RecognitionException { - - TNode multExpr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case STAR: - { - AST __t229 = _t; - TNode tmp151_AST_in = (TNode)_t; - match(_t,STAR); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t229; - _t = _t.getNextSibling(); - break; - } - case DIV: - { - AST __t230 = _t; - TNode tmp152_AST_in = (TNode)_t; - match(_t,DIV); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t230; - _t = _t.getNextSibling(); - break; - } - case MOD: - { - AST __t231 = _t; - TNode tmp153_AST_in = (TNode)_t; - match(_t,MOD); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t231; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void castExpr(AST _t) throws RecognitionException { - - TNode castExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t233 = _t; - TNode tmp154_AST_in = (TNode)_t; - match(_t,NCast); - _t = _t.getFirstChild(); - typeName(_t); - _t = _retTree; - TNode tmp155_AST_in = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - expr(_t); - _t = _retTree; - _t = __t233; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void unaryExpr(AST _t) throws RecognitionException { - - TNode unaryExpr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case INC: - { - AST __t252 = _t; - TNode tmp156_AST_in = (TNode)_t; - match(_t,INC); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - _t = __t252; - _t = _t.getNextSibling(); - break; - } - case DEC: - { - AST __t253 = _t; - TNode tmp157_AST_in = (TNode)_t; - match(_t,DEC); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - _t = __t253; - _t = _t.getNextSibling(); - break; - } - case NUnaryExpr: - { - AST __t254 = _t; - TNode tmp158_AST_in = (TNode)_t; - match(_t,NUnaryExpr); - _t = _t.getFirstChild(); - unaryOperator(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t254; - _t = _t.getNextSibling(); - break; - } - case LITERAL_sizeof: - { - AST __t255 = _t; - TNode tmp159_AST_in = (TNode)_t; - match(_t,LITERAL_sizeof); - _t = _t.getFirstChild(); - { - boolean synPredMatched258 = false; - if (((_t.getType()==LPAREN))) { - AST __t258 = _t; - synPredMatched258 = true; - inputState.guessing++; - try { - { - TNode tmp160_AST_in = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - typeName(_t); - _t = _retTree; - } - } - catch (RecognitionException pe) { - synPredMatched258 = false; - } - _t = __t258; - inputState.guessing--; - } - if ( synPredMatched258 ) { - TNode tmp161_AST_in = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - typeName(_t); - _t = _retTree; - TNode tmp162_AST_in = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - } - else if ((_tokenSet_3.member(_t.getType()))) { - expr(_t); - _t = _retTree; - } - else { - throw new NoViableAltException(_t); - } - - } - _t = __t255; - _t = _t.getNextSibling(); - break; - } - case LITERAL___alignof: - { - AST __t259 = _t; - TNode tmp163_AST_in = (TNode)_t; - match(_t,LITERAL___alignof); - _t = _t.getFirstChild(); - { - boolean synPredMatched262 = false; - if (((_t.getType()==LPAREN))) { - AST __t262 = _t; - synPredMatched262 = true; - inputState.guessing++; - try { - { - TNode tmp164_AST_in = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - typeName(_t); - _t = _retTree; - } - } - catch (RecognitionException pe) { - synPredMatched262 = false; - } - _t = __t262; - inputState.guessing--; - } - if ( synPredMatched262 ) { - TNode tmp165_AST_in = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - typeName(_t); - _t = _retTree; - TNode tmp166_AST_in = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - } - else if ((_tokenSet_3.member(_t.getType()))) { - expr(_t); - _t = _retTree; - } - else { - throw new NoViableAltException(_t); - } - - } - _t = __t259; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void postfixExpr(AST _t) throws RecognitionException { - - TNode postfixExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t265 = _t; - TNode tmp167_AST_in = (TNode)_t; - match(_t,NPostfixExpr); - _t = _t.getFirstChild(); - primaryExpr(_t); - _t = _retTree; - { - int _cnt269=0; - _loop269: - do { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case PTR: - { - TNode tmp168_AST_in = (TNode)_t; - match(_t,PTR); - _t = _t.getNextSibling(); - TNode tmp169_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - break; - } - case DOT: - { - TNode tmp170_AST_in = (TNode)_t; - match(_t,DOT); - _t = _t.getNextSibling(); - TNode tmp171_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - break; - } - case NFunctionCallArgs: - { - AST __t267 = _t; - TNode tmp172_AST_in = (TNode)_t; - match(_t,NFunctionCallArgs); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - case ASSIGN: - case STAR: - case LPAREN: - case DIV_ASSIGN: - case PLUS_ASSIGN: - case MINUS_ASSIGN: - case STAR_ASSIGN: - case MOD_ASSIGN: - case RSHIFT_ASSIGN: - case LSHIFT_ASSIGN: - case BAND_ASSIGN: - case BOR_ASSIGN: - case BXOR_ASSIGN: - case QUESTION: - case LOR: - case LAND: - case BOR: - case BXOR: - case BAND: - case EQUAL: - case NOT_EQUAL: - case LT: - case LTE: - case GT: - case GTE: - case LSHIFT: - case RSHIFT: - case PLUS: - case MINUS: - case DIV: - case MOD: - case INC: - case DEC: - case LITERAL_sizeof: - case CharLiteral: - case NCast: - case NExpressionGroup: - case NInitializer: - case NEmptyExpression: - case NCommaExpr: - case NUnaryExpr: - case NPostfixExpr: - case NRangeExpr: - case NStringSeq: - case NLcurlyInitializer: - case NGnuAsmExpr: - case Number: - case LITERAL___alignof: - { - argExprList(_t); - _t = _retTree; - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp173_AST_in = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - _t = __t267; - _t = _t.getNextSibling(); - break; - } - case LBRACKET: - { - TNode tmp174_AST_in = (TNode)_t; - match(_t,LBRACKET); - _t = _t.getNextSibling(); - expr(_t); - _t = _retTree; - TNode tmp175_AST_in = (TNode)_t; - match(_t,RBRACKET); - _t = _t.getNextSibling(); - break; - } - case INC: - { - TNode tmp176_AST_in = (TNode)_t; - match(_t,INC); - _t = _t.getNextSibling(); - break; - } - case DEC: - { - TNode tmp177_AST_in = (TNode)_t; - match(_t,DEC); - _t = _t.getNextSibling(); - break; - } - default: - { - if ( _cnt269>=1 ) { break _loop269; } else {throw new NoViableAltException(_t);} - } - } - _cnt269++; - } while (true); - } - _t = __t265; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void primaryExpr(AST _t) throws RecognitionException { - - TNode primaryExpr_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case ID: - { - TNode tmp178_AST_in = (TNode)_t; - match(_t,ID); - _t = _t.getNextSibling(); - break; - } - case Number: - { - TNode tmp179_AST_in = (TNode)_t; - match(_t,Number); - _t = _t.getNextSibling(); - break; - } - case CharLiteral: - { - charConst(_t); - _t = _retTree; - break; - } - case NStringSeq: - { - stringConst(_t); - _t = _retTree; - break; - } - case NExpressionGroup: - { - AST __t271 = _t; - TNode tmp180_AST_in = (TNode)_t; - match(_t,NExpressionGroup); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - _t = __t271; - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void commaExpr(AST _t) throws RecognitionException { - - TNode commaExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t167 = _t; - TNode tmp181_AST_in = (TNode)_t; - match(_t,NCommaExpr); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - expr(_t); - _t = _retTree; - _t = __t167; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void emptyExpr(AST _t) throws RecognitionException { - - TNode emptyExpr_AST_in = (TNode)_t; - - try { // for error handling - TNode tmp182_AST_in = (TNode)_t; - match(_t,NEmptyExpression); - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void compoundStatementExpr(AST _t) throws RecognitionException { - - TNode compoundStatementExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t170 = _t; - TNode tmp183_AST_in = (TNode)_t; - match(_t,LPAREN); - _t = _t.getFirstChild(); - compoundStatement(_t); - _t = _retTree; - TNode tmp184_AST_in = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - _t = __t170; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void rangeExpr(AST _t) throws RecognitionException { - - TNode rangeExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t172 = _t; - TNode tmp185_AST_in = (TNode)_t; - match(_t,NRangeExpr); - _t = _t.getFirstChild(); - expr(_t); - _t = _retTree; - TNode tmp186_AST_in = (TNode)_t; - match(_t,VARARGS); - _t = _t.getNextSibling(); - expr(_t); - _t = _retTree; - _t = __t172; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void gnuAsmExpr(AST _t) throws RecognitionException { - - TNode gnuAsmExpr_AST_in = (TNode)_t; - - try { // for error handling - AST __t174 = _t; - TNode tmp187_AST_in = (TNode)_t; - match(_t,NGnuAsmExpr); - _t = _t.getFirstChild(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_volatile: - { - TNode tmp188_AST_in = (TNode)_t; - match(_t,LITERAL_volatile); - _t = _t.getNextSibling(); - break; - } - case LPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp189_AST_in = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - stringConst(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==COLON)) { - TNode tmp190_AST_in = (TNode)_t; - match(_t,COLON); - _t = _t.getNextSibling(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NStringSeq: - { - strOptExprPair(_t); - _t = _retTree; - { - _loop179: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==COMMA)) { - TNode tmp191_AST_in = (TNode)_t; - match(_t,COMMA); - _t = _t.getNextSibling(); - strOptExprPair(_t); - _t = _retTree; - } - else { - break _loop179; - } - - } while (true); - } - break; - } - case COLON: - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==COLON)) { - TNode tmp192_AST_in = (TNode)_t; - match(_t,COLON); - _t = _t.getNextSibling(); - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case NStringSeq: - { - strOptExprPair(_t); - _t = _retTree; - { - _loop183: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==COMMA)) { - TNode tmp193_AST_in = (TNode)_t; - match(_t,COMMA); - _t = _t.getNextSibling(); - strOptExprPair(_t); - _t = _retTree; - } - else { - break _loop183; - } - - } while (true); - } - break; - } - case COLON: - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - } - else if ((_t.getType()==COLON||_t.getType()==RPAREN)) { - } - else { - throw new NoViableAltException(_t); - } - - } - } - else if ((_t.getType()==COLON||_t.getType()==RPAREN)) { - } - else { - throw new NoViableAltException(_t); - } - - } - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case COLON: - { - TNode tmp194_AST_in = (TNode)_t; - match(_t,COLON); - _t = _t.getNextSibling(); - stringConst(_t); - _t = _retTree; - { - _loop186: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==COMMA)) { - TNode tmp195_AST_in = (TNode)_t; - match(_t,COMMA); - _t = _t.getNextSibling(); - stringConst(_t); - _t = _retTree; - } - else { - break _loop186; - } - - } while (true); - } - break; - } - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - TNode tmp196_AST_in = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - _t = __t174; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - protected final void stringConst(AST _t) throws RecognitionException { - - TNode stringConst_AST_in = (TNode)_t; - - try { // for error handling - AST __t277 = _t; - TNode tmp197_AST_in = (TNode)_t; - match(_t,NStringSeq); - _t = _t.getFirstChild(); - { - int _cnt279=0; - _loop279: - do { - if (_t==null) _t=ASTNULL; - if ((_t.getType()==StringLiteral)) { - TNode tmp198_AST_in = (TNode)_t; - match(_t,StringLiteral); - _t = _t.getNextSibling(); - } - else { - if ( _cnt279>=1 ) { break _loop279; } else {throw new NoViableAltException(_t);} - } - - _cnt279++; - } while (true); - } - _t = __t277; - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void strOptExprPair(AST _t) throws RecognitionException { - - TNode strOptExprPair_AST_in = (TNode)_t; - - try { // for error handling - stringConst(_t); - _t = _retTree; - { - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LPAREN: - { - TNode tmp199_AST_in = (TNode)_t; - match(_t,LPAREN); - _t = _t.getNextSibling(); - expr(_t); - _t = _retTree; - TNode tmp200_AST_in = (TNode)_t; - match(_t,RPAREN); - _t = _t.getNextSibling(); - break; - } - case COMMA: - case COLON: - case RPAREN: - { - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void unaryOperator(AST _t) throws RecognitionException { - - TNode unaryOperator_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case BAND: - { - TNode tmp201_AST_in = (TNode)_t; - match(_t,BAND); - _t = _t.getNextSibling(); - break; - } - case STAR: - { - TNode tmp202_AST_in = (TNode)_t; - match(_t,STAR); - _t = _t.getNextSibling(); - break; - } - case PLUS: - { - TNode tmp203_AST_in = (TNode)_t; - match(_t,PLUS); - _t = _t.getNextSibling(); - break; - } - case MINUS: - { - TNode tmp204_AST_in = (TNode)_t; - match(_t,MINUS); - _t = _t.getNextSibling(); - break; - } - case BNOT: - { - TNode tmp205_AST_in = (TNode)_t; - match(_t,BNOT); - _t = _t.getNextSibling(); - break; - } - case LNOT: - { - TNode tmp206_AST_in = (TNode)_t; - match(_t,LNOT); - _t = _t.getNextSibling(); - break; - } - case LAND: - { - TNode tmp207_AST_in = (TNode)_t; - match(_t,LAND); - _t = _t.getNextSibling(); - break; - } - case LITERAL___real: - { - TNode tmp208_AST_in = (TNode)_t; - match(_t,LITERAL___real); - _t = _t.getNextSibling(); - break; - } - case LITERAL___imag: - { - TNode tmp209_AST_in = (TNode)_t; - match(_t,LITERAL___imag); - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - public final void argExprList(AST _t) throws RecognitionException { - - TNode argExprList_AST_in = (TNode)_t; - - try { // for error handling - { - int _cnt274=0; - _loop274: - do { - if (_t==null) _t=ASTNULL; - if ((_tokenSet_3.member(_t.getType()))) { - expr(_t); - _t = _retTree; - } - else { - if ( _cnt274>=1 ) { break _loop274; } else {throw new NoViableAltException(_t);} - } - - _cnt274++; - } while (true); - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - protected final void charConst(AST _t) throws RecognitionException { - - TNode charConst_AST_in = (TNode)_t; - - try { // for error handling - TNode tmp210_AST_in = (TNode)_t; - match(_t,CharLiteral); - _t = _t.getNextSibling(); - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - protected final void intConst(AST _t) throws RecognitionException { - - TNode intConst_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case IntOctalConst: - { - TNode tmp211_AST_in = (TNode)_t; - match(_t,IntOctalConst); - _t = _t.getNextSibling(); - break; - } - case LongOctalConst: - { - TNode tmp212_AST_in = (TNode)_t; - match(_t,LongOctalConst); - _t = _t.getNextSibling(); - break; - } - case UnsignedOctalConst: - { - TNode tmp213_AST_in = (TNode)_t; - match(_t,UnsignedOctalConst); - _t = _t.getNextSibling(); - break; - } - case IntIntConst: - { - TNode tmp214_AST_in = (TNode)_t; - match(_t,IntIntConst); - _t = _t.getNextSibling(); - break; - } - case LongIntConst: - { - TNode tmp215_AST_in = (TNode)_t; - match(_t,LongIntConst); - _t = _t.getNextSibling(); - break; - } - case UnsignedIntConst: - { - TNode tmp216_AST_in = (TNode)_t; - match(_t,UnsignedIntConst); - _t = _t.getNextSibling(); - break; - } - case IntHexConst: - { - TNode tmp217_AST_in = (TNode)_t; - match(_t,IntHexConst); - _t = _t.getNextSibling(); - break; - } - case LongHexConst: - { - TNode tmp218_AST_in = (TNode)_t; - match(_t,LongHexConst); - _t = _t.getNextSibling(); - break; - } - case UnsignedHexConst: - { - TNode tmp219_AST_in = (TNode)_t; - match(_t,UnsignedHexConst); - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - protected final void floatConst(AST _t) throws RecognitionException { - - TNode floatConst_AST_in = (TNode)_t; - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case FloatDoubleConst: - { - TNode tmp220_AST_in = (TNode)_t; - match(_t,FloatDoubleConst); - _t = _t.getNextSibling(); - break; - } - case DoubleDoubleConst: - { - TNode tmp221_AST_in = (TNode)_t; - match(_t,DoubleDoubleConst); - _t = _t.getNextSibling(); - break; - } - case LongDoubleConst: - { - TNode tmp222_AST_in = (TNode)_t; - match(_t,LongDoubleConst); - _t = _t.getNextSibling(); - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - if (inputState.guessing==0) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } else { - throw ex; - } - } - _retTree = _t; - } - - - public static final String[] _tokenNames = { - "<0>", - "EOF", - "<2>", - "NULL_TREE_LOOKAHEAD", - "\"typedef\"", - "\"asm\"", - "\"volatile\"", - "LCURLY", - "RCURLY", - "SEMI", - "\"struct\"", - "\"union\"", - "\"enum\"", - "\"auto\"", - "\"register\"", - "\"extern\"", - "\"static\"", - "\"const\"", - "\"void\"", - "\"char\"", - "\"short\"", - "\"int\"", - "\"long\"", - "\"float\"", - "\"double\"", - "\"signed\"", - "\"unsigned\"", - "ID", - "COMMA", - "COLON", - "ASSIGN", - "STAR", - "LPAREN", - "RPAREN", - "LBRACKET", - "RBRACKET", - "VARARGS", - "\"while\"", - "\"do\"", - "\"for\"", - "\"goto\"", - "\"continue\"", - "\"break\"", - "\"return\"", - "\"case\"", - "\"default\"", - "\"if\"", - "\"else\"", - "\"switch\"", - "DIV_ASSIGN", - "PLUS_ASSIGN", - "MINUS_ASSIGN", - "STAR_ASSIGN", - "MOD_ASSIGN", - "RSHIFT_ASSIGN", - "LSHIFT_ASSIGN", - "BAND_ASSIGN", - "BOR_ASSIGN", - "BXOR_ASSIGN", - "QUESTION", - "LOR", - "LAND", - "BOR", - "BXOR", - "BAND", - "EQUAL", - "NOT_EQUAL", - "LT", - "LTE", - "GT", - "GTE", - "LSHIFT", - "RSHIFT", - "PLUS", - "MINUS", - "DIV", - "MOD", - "INC", - "DEC", - "\"sizeof\"", - "BNOT", - "LNOT", - "PTR", - "DOT", - "CharLiteral", - "StringLiteral", - "IntOctalConst", - "LongOctalConst", - "UnsignedOctalConst", - "IntIntConst", - "LongIntConst", - "UnsignedIntConst", - "IntHexConst", - "LongHexConst", - "UnsignedHexConst", - "FloatDoubleConst", - "DoubleDoubleConst", - "LongDoubleConst", - "NTypedefName", - "NInitDecl", - "NDeclarator", - "NStructDeclarator", - "NDeclaration", - "NCast", - "NPointerGroup", - "NExpressionGroup", - "NFunctionCallArgs", - "NNonemptyAbstractDeclarator", - "NInitializer", - "NStatementExpr", - "NEmptyExpression", - "NParameterTypeList", - "NFunctionDef", - "NCompoundStatement", - "NParameterDeclaration", - "NCommaExpr", - "NUnaryExpr", - "NLabel", - "NPostfixExpr", - "NRangeExpr", - "NStringSeq", - "NInitializerElementLabel", - "NLcurlyInitializer", - "NAsmAttribute", - "NGnuAsmExpr", - "NTypeMissing", - "Vocabulary", - "Whitespace", - "Comment", - "CPPComment", - "a line directive", - "Space", - "LineDirective", - "BadStringLiteral", - "Escape", - "Digit", - "LongSuffix", - "UnsignedSuffix", - "FloatSuffix", - "Exponent", - "Number", - "\"__label__\"", - "\"inline\"", - "\"byte\"", - "\"boolean\"", - "\"Servo\"", - "\"Wire\"", - "\"typeof\"", - "\"__complex\"", - "\"__attribute\"", - "\"__alignof\"", - "\"__real\"", - "\"__imag\"" - }; - - private static final long[] mk_tokenSet_0() { - long[] data = { 544L, 2306124759068311552L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); - private static final long[] mk_tokenSet_1() { - long[] data = { 134093888L, 17179869184L, 2064384L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); - private static final long[] mk_tokenSet_2() { - long[] data = { 422075026113024L, 9605333580251136L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); - private static final long[] mk_tokenSet_3() { - long[] data = { -562942303010816L, 1574098779476393983L, 4198400L, 0L, 0L, 0L}; - return data; - } - public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3()); - } - diff --git a/app/preproc/WTreeParserTokenTypes.java b/app/preproc/WTreeParserTokenTypes.java deleted file mode 100644 index 28cb8f164..000000000 --- a/app/preproc/WTreeParserTokenTypes.java +++ /dev/null @@ -1,162 +0,0 @@ -// $ANTLR 2.7.2: "WTreeParser.g" -> "WTreeParser.java"$ - -package processing.app.preproc; - -import java.io.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; - -public interface WTreeParserTokenTypes { - int EOF = 1; - int NULL_TREE_LOOKAHEAD = 3; - int LITERAL_typedef = 4; - int LITERAL_asm = 5; - int LITERAL_volatile = 6; - int LCURLY = 7; - int RCURLY = 8; - int SEMI = 9; - int LITERAL_struct = 10; - int LITERAL_union = 11; - int LITERAL_enum = 12; - int LITERAL_auto = 13; - int LITERAL_register = 14; - int LITERAL_extern = 15; - int LITERAL_static = 16; - int LITERAL_const = 17; - int LITERAL_void = 18; - int LITERAL_char = 19; - int LITERAL_short = 20; - int LITERAL_int = 21; - int LITERAL_long = 22; - int LITERAL_float = 23; - int LITERAL_double = 24; - int LITERAL_signed = 25; - int LITERAL_unsigned = 26; - int ID = 27; - int COMMA = 28; - int COLON = 29; - int ASSIGN = 30; - int STAR = 31; - int LPAREN = 32; - int RPAREN = 33; - int LBRACKET = 34; - int RBRACKET = 35; - int VARARGS = 36; - int LITERAL_while = 37; - int LITERAL_do = 38; - int LITERAL_for = 39; - int LITERAL_goto = 40; - int LITERAL_continue = 41; - int LITERAL_break = 42; - int LITERAL_return = 43; - int LITERAL_case = 44; - int LITERAL_default = 45; - int LITERAL_if = 46; - int LITERAL_else = 47; - int LITERAL_switch = 48; - int DIV_ASSIGN = 49; - int PLUS_ASSIGN = 50; - int MINUS_ASSIGN = 51; - int STAR_ASSIGN = 52; - int MOD_ASSIGN = 53; - int RSHIFT_ASSIGN = 54; - int LSHIFT_ASSIGN = 55; - int BAND_ASSIGN = 56; - int BOR_ASSIGN = 57; - int BXOR_ASSIGN = 58; - int QUESTION = 59; - int LOR = 60; - int LAND = 61; - int BOR = 62; - int BXOR = 63; - int BAND = 64; - int EQUAL = 65; - int NOT_EQUAL = 66; - int LT = 67; - int LTE = 68; - int GT = 69; - int GTE = 70; - int LSHIFT = 71; - int RSHIFT = 72; - int PLUS = 73; - int MINUS = 74; - int DIV = 75; - int MOD = 76; - int INC = 77; - int DEC = 78; - int LITERAL_sizeof = 79; - int BNOT = 80; - int LNOT = 81; - int PTR = 82; - int DOT = 83; - int CharLiteral = 84; - int StringLiteral = 85; - int IntOctalConst = 86; - int LongOctalConst = 87; - int UnsignedOctalConst = 88; - int IntIntConst = 89; - int LongIntConst = 90; - int UnsignedIntConst = 91; - int IntHexConst = 92; - int LongHexConst = 93; - int UnsignedHexConst = 94; - int FloatDoubleConst = 95; - int DoubleDoubleConst = 96; - int LongDoubleConst = 97; - int NTypedefName = 98; - int NInitDecl = 99; - int NDeclarator = 100; - int NStructDeclarator = 101; - int NDeclaration = 102; - int NCast = 103; - int NPointerGroup = 104; - int NExpressionGroup = 105; - int NFunctionCallArgs = 106; - int NNonemptyAbstractDeclarator = 107; - int NInitializer = 108; - int NStatementExpr = 109; - int NEmptyExpression = 110; - int NParameterTypeList = 111; - int NFunctionDef = 112; - int NCompoundStatement = 113; - int NParameterDeclaration = 114; - int NCommaExpr = 115; - int NUnaryExpr = 116; - int NLabel = 117; - int NPostfixExpr = 118; - int NRangeExpr = 119; - int NStringSeq = 120; - int NInitializerElementLabel = 121; - int NLcurlyInitializer = 122; - int NAsmAttribute = 123; - int NGnuAsmExpr = 124; - int NTypeMissing = 125; - int Vocabulary = 126; - int Whitespace = 127; - int Comment = 128; - int CPPComment = 129; - int PREPROC_DIRECTIVE = 130; - int Space = 131; - int LineDirective = 132; - int BadStringLiteral = 133; - int Escape = 134; - int Digit = 135; - int LongSuffix = 136; - int UnsignedSuffix = 137; - int FloatSuffix = 138; - int Exponent = 139; - int Number = 140; - int LITERAL___label__ = 141; - int LITERAL_inline = 142; - int LITERAL_byte = 143; - int LITERAL_boolean = 144; - int LITERAL_Servo = 145; - int LITERAL_Wire = 146; - int LITERAL_typeof = 147; - int LITERAL___complex = 148; - int LITERAL___attribute = 149; - int LITERAL___alignof = 150; - int LITERAL___real = 151; - int LITERAL___imag = 152; -} diff --git a/app/preproc/WTreeParserTokenTypes.txt b/app/preproc/WTreeParserTokenTypes.txt deleted file mode 100644 index e4c9dee2e..000000000 --- a/app/preproc/WTreeParserTokenTypes.txt +++ /dev/null @@ -1,151 +0,0 @@ -// $ANTLR 2.7.2: WTreeParser.g -> WTreeParserTokenTypes.txt$ -WTreeParser // output token vocab name -LITERAL_typedef="typedef"=4 -LITERAL_asm="asm"=5 -LITERAL_volatile="volatile"=6 -LCURLY=7 -RCURLY=8 -SEMI=9 -LITERAL_struct="struct"=10 -LITERAL_union="union"=11 -LITERAL_enum="enum"=12 -LITERAL_auto="auto"=13 -LITERAL_register="register"=14 -LITERAL_extern="extern"=15 -LITERAL_static="static"=16 -LITERAL_const="const"=17 -LITERAL_void="void"=18 -LITERAL_char="char"=19 -LITERAL_short="short"=20 -LITERAL_int="int"=21 -LITERAL_long="long"=22 -LITERAL_float="float"=23 -LITERAL_double="double"=24 -LITERAL_signed="signed"=25 -LITERAL_unsigned="unsigned"=26 -ID=27 -COMMA=28 -COLON=29 -ASSIGN=30 -STAR=31 -LPAREN=32 -RPAREN=33 -LBRACKET=34 -RBRACKET=35 -VARARGS=36 -LITERAL_while="while"=37 -LITERAL_do="do"=38 -LITERAL_for="for"=39 -LITERAL_goto="goto"=40 -LITERAL_continue="continue"=41 -LITERAL_break="break"=42 -LITERAL_return="return"=43 -LITERAL_case="case"=44 -LITERAL_default="default"=45 -LITERAL_if="if"=46 -LITERAL_else="else"=47 -LITERAL_switch="switch"=48 -DIV_ASSIGN=49 -PLUS_ASSIGN=50 -MINUS_ASSIGN=51 -STAR_ASSIGN=52 -MOD_ASSIGN=53 -RSHIFT_ASSIGN=54 -LSHIFT_ASSIGN=55 -BAND_ASSIGN=56 -BOR_ASSIGN=57 -BXOR_ASSIGN=58 -QUESTION=59 -LOR=60 -LAND=61 -BOR=62 -BXOR=63 -BAND=64 -EQUAL=65 -NOT_EQUAL=66 -LT=67 -LTE=68 -GT=69 -GTE=70 -LSHIFT=71 -RSHIFT=72 -PLUS=73 -MINUS=74 -DIV=75 -MOD=76 -INC=77 -DEC=78 -LITERAL_sizeof="sizeof"=79 -BNOT=80 -LNOT=81 -PTR=82 -DOT=83 -CharLiteral=84 -StringLiteral=85 -IntOctalConst=86 -LongOctalConst=87 -UnsignedOctalConst=88 -IntIntConst=89 -LongIntConst=90 -UnsignedIntConst=91 -IntHexConst=92 -LongHexConst=93 -UnsignedHexConst=94 -FloatDoubleConst=95 -DoubleDoubleConst=96 -LongDoubleConst=97 -NTypedefName=98 -NInitDecl=99 -NDeclarator=100 -NStructDeclarator=101 -NDeclaration=102 -NCast=103 -NPointerGroup=104 -NExpressionGroup=105 -NFunctionCallArgs=106 -NNonemptyAbstractDeclarator=107 -NInitializer=108 -NStatementExpr=109 -NEmptyExpression=110 -NParameterTypeList=111 -NFunctionDef=112 -NCompoundStatement=113 -NParameterDeclaration=114 -NCommaExpr=115 -NUnaryExpr=116 -NLabel=117 -NPostfixExpr=118 -NRangeExpr=119 -NStringSeq=120 -NInitializerElementLabel=121 -NLcurlyInitializer=122 -NAsmAttribute=123 -NGnuAsmExpr=124 -NTypeMissing=125 -Vocabulary=126 -Whitespace=127 -Comment=128 -CPPComment=129 -PREPROC_DIRECTIVE("a line directive")=130 -Space=131 -LineDirective=132 -BadStringLiteral=133 -Escape=134 -Digit=135 -LongSuffix=136 -UnsignedSuffix=137 -FloatSuffix=138 -Exponent=139 -Number=140 -LITERAL___label__="__label__"=141 -LITERAL_inline="inline"=142 -LITERAL_byte="byte"=143 -LITERAL_boolean="boolean"=144 -LITERAL_Servo="Servo"=145 -LITERAL_Wire="Wire"=146 -LITERAL_typeof="typeof"=147 -LITERAL___complex="__complex"=148 -LITERAL___attribute="__attribute"=149 -LITERAL___alignof="__alignof"=150 -LITERAL___real="__real"=151 -LITERAL___imag="__imag"=152 diff --git a/app/preproc/expandedWEmitter.g b/app/preproc/expandedWEmitter.g deleted file mode 100644 index 98241a915..000000000 --- a/app/preproc/expandedWEmitter.g +++ /dev/null @@ -1,1057 +0,0 @@ -header { -package processing.app.preproc; -import processing.app.*; -import java.io.*; -import java.util.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; -} -class WEmitter extends TreeParser; - -options { - importVocab= W; - buildAST= false; - ASTLabelType= "TNode"; - codeGenMakeSwitchThreshold= 2; - codeGenBitsetTestThreshold= 3; -} - -{ - - -int tabs = 0; -PrintStream currentOutput = System.out; -int lineNum = 1; -String currentSource = ""; -LineObject trueSourceFile; -final int lineDirectiveThreshold = Integer.MAX_VALUE; -PreprocessorInfoChannel preprocessorInfoChannel = null; -Stack sourceFiles = new Stack(); - -WEmitter( PreprocessorInfoChannel preprocChannel ) -{ - preprocessorInfoChannel = preprocChannel; -} - - -public void setOut(PrintStream out) { - this.currentOutput = out; -} - -boolean childContains(AST ast, String childName) { - AST child = ast.getFirstChild(); - AST childchild; - while (child != null) { - //System.out.println(child.getText()); - if (child.getText().equals(childName)) { - // debug.println("getChild: found:" + name(ast)); - return true; - } - if(child.getFirstChild() != null) { - if(childContains(child, childName)) { - return true; - } - } - child = child.getNextSibling(); - } - return false; -} - -public void printDeclarations(AST ast) throws RunnerException { - if (ast == null) { - return; - } - - /*if(!childContains(ast, "serialEvent")) { - currentOutput.print("void serialEvent() {}"); - }*/ - if(!childContains(ast, "setup")) { - currentOutput.print("void setup() {}"); - } - if(!childContains(ast, "loop")) { - currentOutput.print("void loop() {}"); - } -} - - -void initializePrinting() -{ - Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber( new Integer(1) ); - printPreprocs(preprocs); -/* if ( currentSource.equals("") ) { - trueSourceFile = new LineObject(currentSource); - currentOutput.println("# 1 \"" + currentSource + "\"\n"); - sourceFiles.push(trueSourceFile); - } -*/ -} - -void finalizePrinting() { - // flush any leftover preprocessing instructions to the stream - - printPreprocs( - preprocessorInfoChannel.extractLinesPrecedingTokenNumber( - new Integer( preprocessorInfoChannel.getMaxTokenNumber() + 1 ) )); - //print a newline so file ends at a new line - currentOutput.println(); -} - -void printPreprocs( Vector preprocs ) -{ - // if there was a preprocessingDirective previous to this token then - // print a newline and the directive, line numbers handled later - if ( preprocs.size() > 0 ) { - if ( trueSourceFile != null ) { - currentOutput.println(); //make sure we're starting a new line unless this is the first line directive - } - lineNum++; - Enumeration e = preprocs.elements(); - while (e.hasMoreElements()) - { - Object o = e.nextElement(); - if ( o.getClass().getName().equals("LineObject") ) { - LineObject l = (LineObject) o; - - // we always return to the trueSourceFile, we never enter it from another file - // force it to be returning if in fact we aren't currently in trueSourceFile - if (( trueSourceFile != null ) //trueSource exists - && ( !currentSource.equals(trueSourceFile.getSource()) ) //currently not in trueSource - && ( trueSourceFile.getSource().equals(l.getSource()) ) ) { //returning to trueSource - l.setEnteringFile( false ); - l.setReturningToFile( true ); - } - - - // print the line directive - currentOutput.println(l); - lineNum = l.getLine(); - currentSource = l.getSource(); - - - // the very first line directive always represents the true sourcefile - if ( trueSourceFile == null ) { - trueSourceFile = new LineObject(currentSource); - sourceFiles.push(trueSourceFile); - } - - // keep our own stack of files entered - if ( l.getEnteringFile() ) { - sourceFiles.push(l); - } - - // if returning to a file, pop the exited files off the stack - if ( l.getReturningToFile() ) { - LineObject top = (LineObject) sourceFiles.peek(); - while (( top != trueSourceFile ) && (! l.getSource().equals(top.getSource()) )) { - sourceFiles.pop(); - top = (LineObject) sourceFiles.peek(); - } - } - } - else { // it was a #pragma or such - currentOutput.println(o); - lineNum++; - } - } - } - -} - -void print( TNode t ) { - int tLineNum = t.getLocalLineNum(); - if ( tLineNum == 0 ) tLineNum = lineNum; - - Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber((Integer)t.getAttribute("tokenNumber")); - printPreprocs(preprocs); - - if ( (lineNum != tLineNum) ) { - // we know we'll be newlines or a line directive or it probably - // is just the case that this token is on the next line - // either way start a new line and indent it - currentOutput.println(); - lineNum++; - printTabs(); - } - - if ( lineNum == tLineNum ){ - // do nothing special, we're at the right place - } - else { - int diff = tLineNum - lineNum; - if ( lineNum < tLineNum ) { - // print out the blank lines to bring us up to right line number - for ( ; lineNum < tLineNum ; lineNum++ ) { - currentOutput.println(); - } - printTabs(); - } - else { // just reset lineNum - lineNum = tLineNum; - } - } - currentOutput.print( t.getText() + " " ); -} - - -/* This was my attempt at being smart about line numbers - It didn't work quite right but I don't know why, I didn't - have enough test cases. Worked ok compiling rcs and ghostscript -*/ -void printAddingLineDirectives( TNode t ) { - int tLineNum = t.getLocalLineNum(); - String tSource = (String) t.getAttribute("source"); - - if ( tSource == null ) tSource = currentSource; - if ( tLineNum == 0 ) tLineNum = lineNum; - - Vector preprocs = preprocessorInfoChannel.extractLinesPrecedingTokenNumber((Integer)t.getAttribute("tokenNumber")); - printPreprocs(preprocs); - - if ( (lineNum != tLineNum) || !currentSource.equals(tSource) ) { - // we know we'll be newlines or a line directive or it probably - // is just the case that this token is on the next line - // either way start a new line and indent it - currentOutput.println(); - lineNum++; - printTabs(); - } - - if ( ( lineNum == tLineNum ) && ( currentSource.equals(tSource) ) ){ - // do nothing special, we're at the right place - } - else if ( currentSource.equals(tSource) ) { - int diff = tLineNum - lineNum; - if (diff > 0 && diff < lineDirectiveThreshold) { - // print out the blank lines to bring us up to right line number - for ( ; lineNum < tLineNum ; lineNum++ ) { - currentOutput.println(); - } - } - else { // print line directive to get us to right line number - // preserve flags 3 and 4 if present in current file - if ( ! sourceFiles.empty() ) { - LineObject l = (LineObject) sourceFiles.peek(); - StringBuffer tFlags = new StringBuffer(""); - if (l.getSystemHeader()) { - tFlags.append(" 3"); - } - if (l.getTreatAsC()) { - tFlags.append(" 4"); - } - currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + tFlags.toString()); - lineNum = tLineNum; - } - } - - printTabs(); - } - else { // different source - Enumeration sources = sourceFiles.elements(); - // see if we're returning to a file we entered earlier - boolean returningToEarlierFile = false; - while (sources.hasMoreElements()) { - LineObject l = (LineObject) sources.nextElement(); - if (l.getSource().equals(tSource)) { - returningToEarlierFile = true; - break; - } - } - if (returningToEarlierFile) { - // pop off the files we're exiting, but never pop the trueSourceFile - LineObject l = (LineObject) sourceFiles.peek(); - while ( ( l != trueSourceFile ) &&(! l.getSource().equals(tSource) ) ) { - sourceFiles.pop(); - l = (LineObject) sourceFiles.peek(); - } - - // put in the return flag, plus others as needed - StringBuffer tFlags = new StringBuffer(" 2"); - if (l.getSystemHeader()) { - tFlags.append(" 3"); - } - if (l.getTreatAsC()) { - tFlags.append(" 4"); - } - - currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + tFlags); - lineNum = tLineNum; - currentSource = tSource; - printTabs(); - } - else { // entering a file that wasn't in the original source - // pretend we're entering it from top of stack - currentOutput.println("# " + tLineNum + " \"" + tSource + "\"" + " 1"); - lineNum = tLineNum; - currentSource = tSource; - printTabs(); - } - } - currentOutput.print( t.getText() + " " ); -} - -/** It is not ok to print newlines from the String passed in as -it will screw up the line number handling **/ -void print( String s ) { - currentOutput.print( s + " " ); -} - -void printTabs() { - for ( int i = 0; i< tabs; i++ ) { - currentOutput.print( "\t" ); - } -} - -void commaSep( TNode t ) { - print( t ); - if ( t.getNextSibling() != null ) { - print( "," ); - } -} - - int traceDepth = 0; - public void reportError(RecognitionException ex) { - if ( ex != null) { - System.err.println("ANTLR Tree Parsing RecognitionException Error: " + ex.getClass().getName() + " " + ex ); - ex.printStackTrace(System.err); - } - } - public void reportError(NoViableAltException ex) { - System.err.println("ANTLR Tree Parsing NoViableAltException Error: " + ex.toString()); - TNode.printTree( ex.node ); - ex.printStackTrace(System.err); - } - public void reportError(MismatchedTokenException ex) { - if ( ex != null) { - TNode.printTree( ex.node ); - System.err.println("ANTLR Tree Parsing MismatchedTokenException Error: " + ex ); - ex.printStackTrace(System.err); - } - } - public void reportError(String s) { - System.err.println("ANTLR Error from String: " + s); - } - public void reportWarning(String s) { - System.err.println("ANTLR Warning from String: " + s); - } - protected void match(AST t, int ttype) throws MismatchedTokenException { - //System.out.println("match("+ttype+"); cursor is "+t); - super.match(t, ttype); - } - public void match(AST t, BitSet b) throws MismatchedTokenException { - //System.out.println("match("+b+"); cursor is "+t); - super.match(t, b); - } - protected void matchNot(AST t, int ttype) throws MismatchedTokenException { - //System.out.println("matchNot("+ttype+"); cursor is "+t); - super.matchNot(t, ttype); - } - public void traceIn(String rname, AST t) { - traceDepth += 1; - for (int x=0; x typeName - | expr - ) - rp:RPAREN { print( rp ); } - ) - | p:"__complex" { print( p ); } - ; - -typedefName :#(NTypedefName i:ID { print( i ); } ) - ; - -structSpecifier :#( a:"struct" { print( a ); } - structOrUnionBody - ) - ; - -unionSpecifier :#( a:"union" { print( a ); } - structOrUnionBody - ) - ; - -structOrUnionBody :( (ID LCURLY) => i1:ID lc1:LCURLY { print( i1 ); print ( "{" ); tabs++; } - ( structDeclarationList )? - rc1:RCURLY { tabs--; print( rc1 ); } - | lc2:LCURLY { print( lc2 ); tabs++; } - ( structDeclarationList )? - rc2:RCURLY { tabs--; print( rc2 ); } - | i2:ID { print( i2 ); } - ) - ; - -structDeclarationList :( structDeclaration { print( ";" ); } - )+ - ; - -structDeclaration :specifierQualifierList structDeclaratorList - ; - -specifierQualifierList :( - typeSpecifier - | typeQualifier - )+ - ; - -structDeclaratorList :structDeclarator - ( { print(","); } structDeclarator )* - ; - -structDeclarator :#( NStructDeclarator - ( declarator )? - ( c:COLON { print( c ); } expr )? - ( attributeDecl )* - ) - ; - -enumSpecifier :#( a:"enum" { print( a ); } - ( i:ID { print( i ); } )? - ( lc:LCURLY { print( lc ); tabs++; } - enumList - rc:RCURLY { tabs--; print( rc ); } - )? - ) - ; - -enumList :enumerator ( {print(",");} enumerator)* - ; - -enumerator :i:ID { print( i ); } - ( b:ASSIGN { print( b ); } - expr - )? - ; - -attributeDecl :#( a:"__attribute" { print( a ); } - (b:. { print( b ); } )* - ) - | #( n:NAsmAttribute { print( n ); } - lp:LPAREN { print( lp ); } - expr { print( ")" ); } - rp:RPAREN { print( rp ); } - ) - ; - -initDeclList :initDecl - ( { print( "," ); } initDecl )* - ; - -initDecl { String declName = ""; } -:#(NInitDecl - declarator - ( attributeDecl )* - ( a:ASSIGN { print( a ); } - initializer - | b:COLON { print( b ); } - expr - )? - ) - ; - -pointerGroup :#( NPointerGroup - ( a:STAR { print( a ); } - ( typeQualifier )* - )+ - ) - ; - -idList :i:ID { print( i ); } - ( c:COMMA { print( c ); } - id:ID { print( id ); } - )* - ; - -initializer :#( NInitializer (initializerElementLabel)? expr ) - | lcurlyInitializer - ; - -initializerElementLabel :#( NInitializerElementLabel - ( - ( l:LBRACKET { print( l ); } - expr - r:RBRACKET { print( r ); } - (a1:ASSIGN { print( a1 ); } )? - ) - | i1:ID c:COLON { print( i1 ); print( c ); } - | d:DOT i2:ID a2:ASSIGN { print( d ); print( i2 ); print( a2 ); } - ) - ) - ; - -lcurlyInitializer :#(n:NLcurlyInitializer { print( n ); tabs++; } - initializerList - rc:RCURLY { tabs--; print( rc ); } - ) - ; - -initializerList :( i:initializer { commaSep( i ); } - )* - ; - -declarator :#( NDeclarator - ( pointerGroup )? - - ( id:ID { print( id ); } - | lp:LPAREN { print( lp ); } declarator rp:RPAREN { print( rp ); } - ) - - ( #( n:NParameterTypeList { print( n ); } - ( - parameterTypeList - | (idList)? - ) - r:RPAREN { print( r ); } - ) - | lb:LBRACKET { print( lb );} ( expr )? rb:RBRACKET { print( rb ); } - )* - ) - ; - -parameterTypeList :( parameterDeclaration - ( c:COMMA { print( c ); } - | s:SEMI { print( s ); } - )? - )+ - ( v:VARARGS { print( v ); } )? - ; - -parameterDeclaration :#( NParameterDeclaration - declSpecifiers - (declarator | nonemptyAbstractDeclarator)? - ) - ; - -functionDef :#( NFunctionDef - ( functionDeclSpecifiers)? - declarator - (declaration - | v:VARARGS { print( v ); } - )* - compoundStatement - ) - ; - -functionDeclSpecifiers :( functionStorageClassSpecifier - | typeQualifier - | typeSpecifier - )+ - ; - -declarationList :( //ANTLR doesn't know that declarationList properly eats all the declarations - //so it warns about the ambiguity - options { - warnWhenFollowAmbig = false; - } : - localLabelDecl - | declaration - )+ - ; - -localLabelDecl :#(a:"__label__" { print( a ); } - ( i:ID { commaSep( i ); } - )+ - { print( ";" ); } - ) - ; - -compoundStatement :#( cs:NCompoundStatement { print( cs ); tabs++; } - ( declarationList - | functionDef - )* - ( statementList )? - rc:RCURLY { tabs--; print( rc ); } - ) - - ; - -statementList :( statement )+ - ; - -statement :statementBody - ; - -statementBody :s:SEMI { print( s ); } - - | compoundStatement // Group of statements - - | #(NStatementExpr - expr { print( ";" ); } - ) // Expressions - -// Iteration statements: - - | #( w:"while" { print( w ); print( "(" ); } - expr { print( ")" ); } - statement ) - - | #( d:"do" { print( d ); } - statement - { print( " while ( " ); } - expr - { print( " );" ); } - ) - - | #( f:"for" { print( f ); print( "(" ); } - expr { print( ";" ); } - expr { print( ";" ); } - expr { print( ")" ); } - statement - ) - - -// Jump statements: - - | #( g:"goto" { print( g );} - expr { print( ";" ); } - ) - | c:"continue" { print( c ); print( ";" );} - | b:"break" { print( b ); print( ";" );} - | #( r:"return" { print( r ); } - ( expr )? - { print( ";" ); } - ) - - -// Labeled statements: - | #( NLabel - ni:ID { print( ni ); print( ":" ); } - ( statement )? - ) - - | #( - ca:"case" { print( ca ); } - expr { print( ":" ); } - (statement)? - ) - - | #( - de:"default" { print( de ); print( ":" ); } - (statement)? - ) - - - -// Selection statements: - - | #( i:"if" { print( i ); print( "(" ); } - expr { print( ")" ); } - statement - ( e:"else" { print( e ); } - statement - )? - ) - | #( sw:"switch" { print( sw ); print( "(" ); } - expr { print( ")" ); } - statement - ) - - - - ; - -expr :binaryExpr - | conditionalExpr - | castExpr - | unaryExpr - | postfixExpr - | primaryExpr - | emptyExpr - | compoundStatementExpr - | initializer - | rangeExpr - | gnuAsmExpr - ; - -emptyExpr :NEmptyExpression - ; - -compoundStatementExpr :#(l:LPAREN { print( l ); } - compoundStatement - r:RPAREN { print( r ); } - ) - ; - -rangeExpr :#(NRangeExpr expr v:VARARGS{ print( v ); } expr) - ; - -gnuAsmExpr :#(n:NGnuAsmExpr { print( n ); } - (v:"volatile" { print( v ); } )? - lp:LPAREN { print( lp ); } - stringConst - ( options { warnWhenFollowAmbig = false; }: - c1:COLON { print( c1 );} - (strOptExprPair - ( c2:COMMA { print( c2 ); } strOptExprPair)* - )? - ( options { warnWhenFollowAmbig = false; }: - c3:COLON { print( c3 ); } - (strOptExprPair - ( c4:COMMA { print( c4 ); } strOptExprPair)* - )? - )? - )? - ( c5:COLON { print( c5 ); } - stringConst - ( c6:COMMA { print( c6 ); } - stringConst - )* - )? - rp:RPAREN { print( rp ); } - ) - ; - -strOptExprPair :stringConst - ( - l:LPAREN { print( l ); } - expr - r:RPAREN { print( r ); } - )? - ; - -binaryOperator :ASSIGN - | DIV_ASSIGN - | PLUS_ASSIGN - | MINUS_ASSIGN - | STAR_ASSIGN - | MOD_ASSIGN - | RSHIFT_ASSIGN - | LSHIFT_ASSIGN - | BAND_ASSIGN - | BOR_ASSIGN - | BXOR_ASSIGN - | LOR - | LAND - | BOR - | BXOR - | BAND - | EQUAL - | NOT_EQUAL - | LT - | LTE - | GT - | GTE - | LSHIFT - | RSHIFT - | PLUS - | MINUS - | STAR - | DIV - | MOD - | NCommaExpr - ; - -binaryExpr :b:binaryOperator - // no rules allowed as roots, so here I manually get - // the first and second children of the binary operator - // and then print them out in the right order - { TNode e1, e2; - e1 = (TNode) b.getFirstChild(); - e2 = (TNode) e1.getNextSibling(); - expr( e1 ); - print( b ); - expr( e2 ); - } - - ; - -conditionalExpr :#( q:QUESTION - expr { print( q ); } - ( expr )? - c:COLON { print( c ); } - expr - ) - ; - -castExpr :#( - c:NCast { print( c ); } - typeName - rp:RPAREN { print( rp ); } - expr - ) - ; - -typeName :specifierQualifierList (nonemptyAbstractDeclarator)? - ; - -nonemptyAbstractDeclarator :#( NNonemptyAbstractDeclarator - ( pointerGroup - ( (lp1:LPAREN { print( lp1 ); } - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - rp1:RPAREN { print( rp1 ); } - ) - | ( - lb1:LBRACKET { print( lb1 ); } - (expr)? - rb1:RBRACKET { print( rb1 ); } - ) - )* - - | ( (lp2:LPAREN { print( lp2 ); } - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - rp2:RPAREN { print( rp2 ); } - ) - | ( - lb2:LBRACKET { print( lb2 ); } - (expr)? - rb2:RBRACKET { print( rb2 ); } - ) - )+ - ) - ) - ; - -unaryExpr :#( i:INC { print( i ); } expr ) - | #( d:DEC { print( d ); } expr ) - | #( NUnaryExpr u:unaryOperator { print( u ); } expr) - | #( s:"sizeof" { print( s ); } - ( ( LPAREN typeName )=> - lps:LPAREN { print( lps ); } - typeName - rps:RPAREN { print( rps ); } - | expr - ) - ) - | #( a:"__alignof" { print( a ); } - ( ( LPAREN typeName )=> - lpa:LPAREN { print( lpa ); } - typeName - rpa:RPAREN { print( rpa ); } - | expr - ) - ) - ; - -unaryOperator :BAND - | STAR - | PLUS - | MINUS - | BNOT - | LNOT - | LAND - | "__real" - | "__imag" - ; - -postfixExpr :#( NPostfixExpr - primaryExpr - ( a:PTR b:ID { print( a ); print( b ); } - | c:DOT d:ID { print( c ); print( d ); } - | #( n:NFunctionCallArgs { print( n ); } - (argExprList)? - rp:RPAREN { print( rp ); } - ) - | lb:LBRACKET { print( lb ); } - expr - rb:RBRACKET { print( rb ); } - | f:INC { print( f ); } - | g:DEC { print( g ); } - )+ - ) - ; - -primaryExpr :i:ID { print( i ); } - | n:Number { print( n ); } - | charConst - | stringConst - -// JTC: -// ID should catch the enumerator -// leaving it in gives ambiguous err -// | enumerator - - | #( eg:NExpressionGroup { print( eg ); } - expr { print( ")" ); } - ) - ; - -argExprList :expr ( {print( "," );} expr )* - ; - -protected charConst :c:CharLiteral { print( c ); } - ; - -protected stringConst :#( NStringSeq - ( - s:StringLiteral { print( s ); } - )+ - ) - ; - -protected intConst :IntOctalConst - | LongOctalConst - | UnsignedOctalConst - | IntIntConst - | LongIntConst - | UnsignedIntConst - | IntHexConst - | LongHexConst - | UnsignedHexConst - ; - -protected floatConst :FloatDoubleConst - | DoubleDoubleConst - | LongDoubleConst - ; - -// inherited from grammar WTreeParser -commaExpr :#(NCommaExpr expr expr) - ; - -// inherited from grammar WTreeParser -assignExpr :#( ASSIGN expr expr) - | #( DIV_ASSIGN expr expr) - | #( PLUS_ASSIGN expr expr) - | #( MINUS_ASSIGN expr expr) - | #( STAR_ASSIGN expr expr) - | #( MOD_ASSIGN expr expr) - | #( RSHIFT_ASSIGN expr expr) - | #( LSHIFT_ASSIGN expr expr) - | #( BAND_ASSIGN expr expr) - | #( BOR_ASSIGN expr expr) - | #( BXOR_ASSIGN expr expr) - ; - -// inherited from grammar WTreeParser -logicalOrExpr :#( LOR expr expr) - ; - -// inherited from grammar WTreeParser -logicalAndExpr :#( LAND expr expr ) - ; - -// inherited from grammar WTreeParser -inclusiveOrExpr :#( BOR expr expr ) - ; - -// inherited from grammar WTreeParser -exclusiveOrExpr :#( BXOR expr expr ) - ; - -// inherited from grammar WTreeParser -bitAndExpr :#( BAND expr expr ) - ; - -// inherited from grammar WTreeParser -equalityExpr :#( EQUAL expr expr) - | #( NOT_EQUAL expr expr) - ; - -// inherited from grammar WTreeParser -relationalExpr :#( LT expr expr) - | #( LTE expr expr) - | #( GT expr expr) - | #( GTE expr expr) - ; - -// inherited from grammar WTreeParser -shiftExpr :#( LSHIFT expr expr) - | #( RSHIFT expr expr) - ; - -// inherited from grammar WTreeParser -additiveExpr :#( PLUS expr expr) - | #( MINUS expr expr) - ; - -// inherited from grammar WTreeParser -multExpr :#( STAR expr expr) - | #( DIV expr expr) - | #( MOD expr expr) - ; - - diff --git a/app/preproc/expandedWParser.g b/app/preproc/expandedWParser.g deleted file mode 100644 index b23ba3a57..000000000 --- a/app/preproc/expandedWParser.g +++ /dev/null @@ -1,1335 +0,0 @@ -header { -package processing.app.preproc; - -import java.io.*; - -import antlr.CommonAST; -import antlr.DumpASTVisitor; -} -class WParser extends Parser; - -options { - k= 2; - exportVocab= W; - buildAST= true; - ASTLabelType= "TNode"; - defaultErrorHandler= false; - codeGenMakeSwitchThreshold= 2; - codeGenBitsetTestThreshold= 3; - importVocab=STDC; -} - -{ - // Suppport C++-style single-line comments? - public static boolean CPPComments = true; - - // access to symbol table - public CSymbolTable symbolTable = new CSymbolTable(); - - // source for names to unnamed scopes - protected int unnamedScopeCounter = 0; - - public boolean isTypedefName(String name) { - boolean returnValue = false; - TNode node = symbolTable.lookupNameInCurrentScope(name); - for (; node != null; node = (TNode) node.getNextSibling() ) { - if(node.getType() == LITERAL_typedef) { - returnValue = true; - break; - } - } - return returnValue; - } - - - public String getAScopeName() { - return "" + (unnamedScopeCounter++); - } - - public void pushScope(String scopeName) { - symbolTable.pushScope(scopeName); - } - - public void popScope() { - symbolTable.popScope(); - } - - int traceDepth = 0; - public void reportError(RecognitionException ex) { - try { - System.err.println("ANTLR Parsing Error: "+ex + " token name:" + tokenNames[LA(1)]); - ex.printStackTrace(System.err); - } - catch (TokenStreamException e) { - System.err.println("ANTLR Parsing Error: "+ex); - ex.printStackTrace(System.err); - } - } - public void reportError(String s) { - System.err.println("ANTLR Parsing Error from String: " + s); - } - public void reportWarning(String s) { - System.err.println("ANTLR Parsing Warning from String: " + s); - } - public void match(int t) throws MismatchedTokenException { - boolean debugging = false; - - if ( debugging ) { - for (int x=0; x0)?" [inputState.guessing "+ inputState.guessing + "]":"")); - - } - - } - try { - if ( LA(1)!=t ) { - if ( debugging ){ - for (int x=0; x "+rname+"; LA(1)==("+ tokenNames[LT(1).getType()] - + ") " + LT(1).getText() + " [inputState.guessing "+ inputState.guessing + "]"); - } - catch (TokenStreamException e) { - } - } - public void traceOut(String rname) { - for (int x=0; x declaration - | ( functionPrefix )=> functionDef - | typelessDeclaration - | asm_expr - | SEMI - ; - -functionPrefix { String declName; } -:( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers - | //epsilon - ) - declName = d:declarator[true] - ( declaration )* (VARARGS)? ( SEMI )* - LCURLY - ; - -typelessDeclaration { AST typeMissing = #[NTypeMissing]; } -:initDeclList[typeMissing] SEMI { ## = #( #[NTypeMissing], ##); } - ; - -initializer :( ( ( (initializerElementLabel)=> initializerElementLabel )? - ( assignExpr | lcurlyInitializer ) { ## = #( #[NInitializer], ## ); } - ) - | lcurlyInitializer - ) - ; - -initializerElementLabel :( ( LBRACKET ((constExpr VARARGS)=> rangeExpr | constExpr) RBRACKET (ASSIGN)? ) - | ID COLON - | DOT ID ASSIGN - ) - { ## = #( #[NInitializerElementLabel], ##) ; } - ; - -lcurlyInitializer :LCURLY^ (initializerList ( COMMA! )? )? RCURLY - { ##.setType( NLcurlyInitializer ); } - ; - -initializerList :initializer ( options{warnWhenFollowAmbig=false;}:COMMA! initializer )* - ; - -declarator[boolean isFunctionDefinition] returns [String declName]{ declName = ""; } -:( pointerGroup )? - - ( id:ID { declName = id.getText(); } - | LPAREN declName = declarator[false] RPAREN - ) - - ( declaratorParamaterList[isFunctionDefinition, declName] - | LBRACKET ( expr )? RBRACKET - )* - { ## = #( #[NDeclarator], ## ); } - ; - -declaratorParamaterList[boolean isFunctionDefinition, String declName] :LPAREN^ - { - if (isFunctionDefinition) { - pushScope(declName); - } - else { - pushScope("!"+declName); - } - } - ( - (declSpecifiers)=> parameterTypeList - | (idList)? - ) - { - popScope(); - } - ( COMMA! )? - RPAREN - { ##.setType(NParameterTypeList); } - ; - -parameterTypeList :parameterDeclaration - ( options { - warnWhenFollowAmbig = false; - } : - ( COMMA | SEMI ) - parameterDeclaration - )* - ( ( COMMA | SEMI ) - VARARGS - )? - ; - -declarationList :( options { // this loop properly aborts when - // it finds a non-typedefName ID MBZ - warnWhenFollowAmbig = false; - } : - - localLabelDeclaration - | ( declarationPredictor )=> declaration - )+ - ; - -localLabelDeclaration :( //GNU note: any __label__ declarations must come before regular declarations. - "__label__"^ ID (options{warnWhenFollowAmbig=false;}: COMMA! ID)* ( COMMA! )? ( SEMI! )+ - ) - ; - -declaration { AST ds1 = null; } -:ds:declSpecifiers { ds1 = astFactory.dupList(#ds); } - ( - initDeclList[ds1] - )? - ( SEMI )+ - { ## = #( #[NDeclaration], ##); } - - ; - -functionStorageClassSpecifier :"extern" - | "static" - | "inline" - ; - -typeSpecifier[int specCount] returns [int retSpecCount]{ retSpecCount = specCount + 1; } -:( "void" - | "char" - | "short" - | "int" - | "long" - | "float" - | "double" - | "signed" - | "unsigned" - | "byte" - | "boolean" - | "Servo" - | "Wire" - | structOrUnionSpecifier ( options{warnWhenFollowAmbig=false;}: attributeDecl )* - | enumSpecifier - | { specCount==0 }? typedefName - | "typeof"^ LPAREN - ( ( typeName )=> typeName - | expr - ) - RPAREN - | "__complex" - ) - ; - -structOrUnionSpecifier { String scopeName; } -:sou:structOrUnion! - ( ( ID LCURLY )=> i:ID l:LCURLY - { - scopeName = #sou.getText() + " " + #i.getText(); - #l.setText(scopeName); - pushScope(scopeName); - } - ( structDeclarationList )? - { popScope();} - RCURLY - | l1:LCURLY - { - scopeName = getAScopeName(); - #l1.setText(scopeName); - pushScope(scopeName); - } - ( structDeclarationList )? - { popScope(); } - RCURLY - | ID - ) - { - ## = #( #sou, ## ); - } - ; - -structDeclaration :specifierQualifierList structDeclaratorList ( COMMA! )? ( SEMI! )+ - ; - -structDeclaratorList :structDeclarator ( options{warnWhenFollowAmbig=false;}: COMMA! structDeclarator )* - ; - -structDeclarator :( declarator[false] )? - ( COLON constExpr )? - ( attributeDecl )* - { ## = #( #[NStructDeclarator], ##); } - ; - -enumSpecifier :"enum"^ - ( ( ID LCURLY )=> i:ID LCURLY enumList[i.getText()] RCURLY - | LCURLY enumList["anonymous"] RCURLY - | ID - ) - ; - -enumList[String enumName] :enumerator[enumName] ( options{warnWhenFollowAmbig=false;}: COMMA! enumerator[enumName] )* ( COMMA! )? - ; - -initDeclList[AST declarationSpecifiers] :initDecl[declarationSpecifiers] - ( options{warnWhenFollowAmbig=false;}: COMMA! initDecl[declarationSpecifiers] )* - ( COMMA! )? - ; - -initDecl[AST declarationSpecifiers] { String declName = ""; } -:declName = d:declarator[false] - { AST ds1, d1; - ds1 = astFactory.dupList(declarationSpecifiers); - d1 = astFactory.dupList(#d); - symbolTable.add(declName, #(null, ds1, d1) ); - } - ( attributeDecl )* - ( ASSIGN initializer - | COLON expr - )? - { ## = #( #[NInitDecl], ## ); } - ; - -attributeDecl :"__attribute"^ LPAREN LPAREN attributeList RPAREN RPAREN - | "asm"^ LPAREN stringConst RPAREN { ##.setType( NAsmAttribute ); } - ; - -attributeList :attribute ( options{warnWhenFollowAmbig=false;}: COMMA attribute)* ( COMMA )? - ; - -attribute :( ~(LPAREN | RPAREN | COMMA) - | LPAREN attributeList RPAREN - )* - ; - -compoundStatement[String scopeName] :LCURLY^ - - { - pushScope(scopeName); - } - ( //this ambiguity is ok, declarationList and nestedFunctionDef end properly - options { - warnWhenFollowAmbig = false; - } : - ( "typedef" | "__label__" | declaration )=> declarationList - | (nestedFunctionDef)=> nestedFunctionDef - )* - ( statementList )? - { popScope(); } - RCURLY - { ##.setType( NCompoundStatement ); ##.setAttribute( "scopeName", scopeName ); } - ; - -nestedFunctionDef { String declName; } -:( "auto" )? //only for nested functions - ( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers - )? - declName = d:declarator[false] - { - AST d2, ds2; - d2 = astFactory.dupList(#d); - ds2 = astFactory.dupList(#ds); - symbolTable.add(declName, #(null, ds2, d2)); - pushScope(declName); - } - ( declaration )* - { popScope(); } - compoundStatement[declName] - { ## = #( #[NFunctionDef], ## );} - ; - -statement :SEMI // Empty statements - - | compoundStatement[getAScopeName()] // Group of statements - - | expr SEMI! { ## = #( #[NStatementExpr], ## );} // Expressions - -// Iteration statements: - - | "while"^ LPAREN! expr RPAREN! statement - | "do"^ statement "while"! LPAREN! expr RPAREN! SEMI! - |! "for" - LPAREN ( e1:expr )? SEMI ( e2:expr )? SEMI ( e3:expr )? RPAREN - s:statement - { - if ( #e1 == null) { #e1 = #[ NEmptyExpression ]; } - if ( #e2 == null) { #e2 = #[ NEmptyExpression ]; } - if ( #e3 == null) { #e3 = #[ NEmptyExpression ]; } - ## = #( #[LITERAL_for, "for"], #e1, #e2, #e3, #s ); - } - - -// Jump statements: - - | "goto"^ expr SEMI! - | "continue" SEMI! - | "break" SEMI! - | "return"^ ( expr )? SEMI! - - - | ID COLON! (options {warnWhenFollowAmbig=false;}: statement)? { ## = #( #[NLabel], ## ); } -// GNU allows range expressions in case statements - | "case"^ ((constExpr VARARGS)=> rangeExpr | constExpr) COLON! ( options{warnWhenFollowAmbig=false;}:statement )? - | "default"^ COLON! ( options{warnWhenFollowAmbig=false;}: statement )? - -// Selection statements: - - | "if"^ - LPAREN! expr RPAREN! statement - ( //standard if-else ambiguity - options { - warnWhenFollowAmbig = false; - } : - "else" statement )? - | "switch"^ LPAREN! expr RPAREN! statement - ; - -conditionalExpr :logicalOrExpr - ( QUESTION^ (expr)? COLON conditionalExpr )? - ; - -rangeExpr :constExpr VARARGS constExpr - { ## = #(#[NRangeExpr], ##); } - ; - -castExpr :( LPAREN typeName RPAREN )=> - LPAREN^ typeName RPAREN ( castExpr | lcurlyInitializer ) - { ##.setType(NCast); } - - | unaryExpr - ; - -nonemptyAbstractDeclarator :( - pointerGroup - ( (LPAREN - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - ( COMMA! )? - RPAREN) - | (LBRACKET (expr)? RBRACKET) - )* - - | ( (LPAREN - ( nonemptyAbstractDeclarator - | parameterTypeList - )? - ( COMMA! )? - RPAREN) - | (LBRACKET (expr)? RBRACKET) - )+ - ) - { ## = #( #[NNonemptyAbstractDeclarator], ## ); } - - ; - -unaryExpr :postfixExpr - | INC^ castExpr - | DEC^ castExpr - | u:unaryOperator castExpr { ## = #( #[NUnaryExpr], ## ); } - - | "sizeof"^ - ( ( LPAREN typeName )=> LPAREN typeName RPAREN - | unaryExpr - ) - | "__alignof"^ - ( ( LPAREN typeName )=> LPAREN typeName RPAREN - | unaryExpr - ) - | gnuAsmExpr - ; - -unaryOperator :BAND - | STAR - | PLUS - | MINUS - | BNOT //also stands for complex conjugation - | LNOT - | LAND //for label dereference (&&label) - | "__real" - | "__imag" - ; - -gnuAsmExpr :"asm"^ ("volatile")? - LPAREN stringConst - ( options { warnWhenFollowAmbig = false; }: - COLON (strOptExprPair ( COMMA strOptExprPair)* )? - ( options { warnWhenFollowAmbig = false; }: - COLON (strOptExprPair ( COMMA strOptExprPair)* )? - )? - )? - ( COLON stringConst ( COMMA stringConst)* )? - RPAREN - { ##.setType(NGnuAsmExpr); } - ; - -strOptExprPair :stringConst ( LPAREN expr RPAREN )? - ; - -primaryExpr :ID - | Number - | charConst - | stringConst -// JTC: -// ID should catch the enumerator -// leaving it in gives ambiguous err -// | enumerator - | (LPAREN LCURLY) => LPAREN^ compoundStatement[getAScopeName()] RPAREN - | LPAREN^ expr RPAREN { ##.setType(NExpressionGroup); } - ; - -// inherited from grammar StdCParser -externalList :( externalDef )+ - ; - -// inherited from grammar StdCParser -declSpecifiers { int specCount=0; } -:( options { // this loop properly aborts when - // it finds a non-typedefName ID MBZ - warnWhenFollowAmbig = false; - } : - s:storageClassSpecifier - | typeQualifier - | ( "struct" | "union" | "enum" | typeSpecifier[specCount] )=> - specCount = typeSpecifier[specCount] - )+ - ; - -// inherited from grammar StdCParser -storageClassSpecifier :"auto" - | "register" - | "typedef" - | functionStorageClassSpecifier - ; - -// inherited from grammar StdCParser -typeQualifier :"const" - | "volatile" - ; - -// inherited from grammar StdCParser -typedefName :{ isTypedefName ( LT(1).getText() ) }? - i:ID { ## = #(#[NTypedefName], #i); } - ; - -// inherited from grammar StdCParser -structOrUnion :"struct" - | "union" - ; - -// inherited from grammar StdCParser -structDeclarationList :( structDeclaration )+ - ; - -// inherited from grammar StdCParser -specifierQualifierList { int specCount = 0; } -:( options { // this loop properly aborts when - // it finds a non-typedefName ID MBZ - warnWhenFollowAmbig = false; - } : - ( "struct" | "union" | "enum" | typeSpecifier[specCount] )=> - specCount = typeSpecifier[specCount] - | typeQualifier - )+ - ; - -// inherited from grammar StdCParser -enumerator[String enumName] :i:ID { symbolTable.add( i.getText(), - #( null, - #[LITERAL_enum, "enum"], - #[ ID, enumName] - ) - ); - } - (ASSIGN constExpr)? - ; - -// inherited from grammar StdCParser -pointerGroup :( STAR ( typeQualifier )* )+ { ## = #( #[NPointerGroup], ##); } - ; - -// inherited from grammar StdCParser -parameterDeclaration { String declName; } -:ds:declSpecifiers - ( ( declarator[false] )=> declName = d:declarator[false] - { - AST d2, ds2; - d2 = astFactory.dupList(#d); - ds2 = astFactory.dupList(#ds); - symbolTable.add(declName, #(null, ds2, d2)); - } - | nonemptyAbstractDeclarator - )? - { - ## = #( #[NParameterDeclaration], ## ); - } - ; - -// inherited from grammar StdCParser -functionDef { String declName; } -:( (functionDeclSpecifiers)=> ds:functionDeclSpecifiers - | //epsilon - ) - declName = d:declarator[true] - { - AST d2, ds2; - d2 = astFactory.dupList(#d); - ds2 = astFactory.dupList(#ds); - symbolTable.add(declName, #(null, ds2, d2)); - pushScope(declName); - } - ( declaration )* (VARARGS)? ( SEMI! )* - { popScope(); } - compoundStatement[declName] - { ## = #( #[NFunctionDef], ## );} - ; - -// inherited from grammar StdCParser -functionDeclSpecifiers { int specCount = 0; } -:( options { // this loop properly aborts when - // it finds a non-typedefName ID MBZ - warnWhenFollowAmbig = false; - } : - functionStorageClassSpecifier - | typeQualifier - | ( "struct" | "union" | "enum" | typeSpecifier[specCount] )=> - specCount = typeSpecifier[specCount] - )+ - ; - -// inherited from grammar StdCParser -declarationPredictor :(options { //only want to look at declaration if I don't see typedef - warnWhenFollowAmbig = false; - }: - "typedef" - | declaration - ) - ; - -// inherited from grammar StdCParser -statementList :( statement )+ - ; - -// inherited from grammar StdCParser -expr :assignExpr (options { - /* MBZ: - COMMA is ambiguous between comma expressions and - argument lists. argExprList should get priority, - and it does by being deeper in the expr rule tree - and using (COMMA assignExpr)* - */ - warnWhenFollowAmbig = false; - } : - c:COMMA^ { #c.setType(NCommaExpr); } assignExpr - )* - ; - -// inherited from grammar StdCParser -assignExpr :conditionalExpr ( a:assignOperator! assignExpr { ## = #( #a, ## );} )? - ; - -// inherited from grammar StdCParser -assignOperator :ASSIGN - | DIV_ASSIGN - | PLUS_ASSIGN - | MINUS_ASSIGN - | STAR_ASSIGN - | MOD_ASSIGN - | RSHIFT_ASSIGN - | LSHIFT_ASSIGN - | BAND_ASSIGN - | BOR_ASSIGN - | BXOR_ASSIGN - ; - -// inherited from grammar StdCParser -constExpr :conditionalExpr - ; - -// inherited from grammar StdCParser -logicalOrExpr :logicalAndExpr ( LOR^ logicalAndExpr )* - ; - -// inherited from grammar StdCParser -logicalAndExpr :inclusiveOrExpr ( LAND^ inclusiveOrExpr )* - ; - -// inherited from grammar StdCParser -inclusiveOrExpr :exclusiveOrExpr ( BOR^ exclusiveOrExpr )* - ; - -// inherited from grammar StdCParser -exclusiveOrExpr :bitAndExpr ( BXOR^ bitAndExpr )* - ; - -// inherited from grammar StdCParser -bitAndExpr :equalityExpr ( BAND^ equalityExpr )* - ; - -// inherited from grammar StdCParser -equalityExpr :relationalExpr - ( ( EQUAL^ | NOT_EQUAL^ ) relationalExpr )* - ; - -// inherited from grammar StdCParser -relationalExpr :shiftExpr - ( ( LT^ | LTE^ | GT^ | GTE^ ) shiftExpr )* - ; - -// inherited from grammar StdCParser -shiftExpr :additiveExpr - ( ( LSHIFT^ | RSHIFT^ ) additiveExpr )* - ; - -// inherited from grammar StdCParser -additiveExpr :multExpr - ( ( PLUS^ | MINUS^ ) multExpr )* - ; - -// inherited from grammar StdCParser -multExpr :castExpr - ( ( STAR^ | DIV^ | MOD^ ) castExpr )* - ; - -// inherited from grammar StdCParser -typeName :specifierQualifierList (nonemptyAbstractDeclarator)? - ; - -// inherited from grammar StdCParser -postfixExpr :primaryExpr - ( - postfixSuffix {## = #( #[NPostfixExpr], ## );} - )? - ; - -// inherited from grammar StdCParser -postfixSuffix :( PTR ID - | DOT ID - | functionCall - | LBRACKET expr RBRACKET - | INC - | DEC - )+ - ; - -// inherited from grammar StdCParser -functionCall :LPAREN^ (a:argExprList)? RPAREN - { - ##.setType( NFunctionCallArgs ); - } - ; - -// inherited from grammar StdCParser -argExprList :assignExpr ( COMMA! assignExpr )* - ; - -// inherited from grammar StdCParser -protected charConst :CharLiteral - ; - -// inherited from grammar StdCParser -protected stringConst :(StringLiteral)+ { ## = #(#[NStringSeq], ##); } - ; - -// inherited from grammar StdCParser -protected intConst :IntOctalConst - | LongOctalConst - | UnsignedOctalConst - | IntIntConst - | LongIntConst - | UnsignedIntConst - | IntHexConst - | LongHexConst - | UnsignedHexConst - ; - -// inherited from grammar StdCParser -protected floatConst :FloatDoubleConst - | DoubleDoubleConst - | LongDoubleConst - ; - -// inherited from grammar StdCParser -dummy :NTypedefName - | NInitDecl - | NDeclarator - | NStructDeclarator - | NDeclaration - | NCast - | NPointerGroup - | NExpressionGroup - | NFunctionCallArgs - | NNonemptyAbstractDeclarator - | NInitializer - | NStatementExpr - | NEmptyExpression - | NParameterTypeList - | NFunctionDef - | NCompoundStatement - | NParameterDeclaration - | NCommaExpr - | NUnaryExpr - | NLabel - | NPostfixExpr - | NRangeExpr - | NStringSeq - | NInitializerElementLabel - | NLcurlyInitializer - | NAsmAttribute - | NGnuAsmExpr - | NTypeMissing - ; - -{ -// import CToken; - import java.io.*; -// import LineObject; - import antlr.*; -}class WLexer extends Lexer; - -options { - k= 3; - importVocab= W; - testLiterals= false; -} - -tokens { - LITERAL___extension__ = "__extension__"; -} -{ - public void initialize(String src) - { - setOriginalSource(src); - initialize(); - } - - public void initialize() - { - literals.put(new ANTLRHashString("__alignof__", this), new Integer(LITERAL___alignof)); - literals.put(new ANTLRHashString("__asm", this), new Integer(LITERAL_asm)); - literals.put(new ANTLRHashString("__asm__", this), new Integer(LITERAL_asm)); - literals.put(new ANTLRHashString("__attribute__", this), new Integer(LITERAL___attribute)); - literals.put(new ANTLRHashString("__complex__", this), new Integer(LITERAL___complex)); - literals.put(new ANTLRHashString("__const", this), new Integer(LITERAL_const)); - literals.put(new ANTLRHashString("__const__", this), new Integer(LITERAL_const)); - literals.put(new ANTLRHashString("__imag__", this), new Integer(LITERAL___imag)); - literals.put(new ANTLRHashString("__inline", this), new Integer(LITERAL_inline)); - literals.put(new ANTLRHashString("__inline__", this), new Integer(LITERAL_inline)); - literals.put(new ANTLRHashString("__real__", this), new Integer(LITERAL___real)); - literals.put(new ANTLRHashString("__signed", this), new Integer(LITERAL_signed)); - literals.put(new ANTLRHashString("__signed__", this), new Integer(LITERAL_signed)); - literals.put(new ANTLRHashString("__typeof", this), new Integer(LITERAL_typeof)); - literals.put(new ANTLRHashString("__typeof__", this), new Integer(LITERAL_typeof)); - literals.put(new ANTLRHashString("__volatile", this), new Integer(LITERAL_volatile)); - literals.put(new ANTLRHashString("__volatile__", this), new Integer(LITERAL_volatile)); - } - - - LineObject lineObject = new LineObject(); - String originalSource = ""; - PreprocessorInfoChannel preprocessorInfoChannel = new PreprocessorInfoChannel(); - int tokenNumber = 0; - boolean countingTokens = true; - int deferredLineCount = 0; - - public void setCountingTokens(boolean ct) - { - countingTokens = ct; - if ( countingTokens ) { - tokenNumber = 0; - } - else { - tokenNumber = 1; - } - } - - public void setOriginalSource(String src) - { - originalSource = src; - lineObject.setSource(src); - } - public void setSource(String src) - { - lineObject.setSource(src); - } - - public PreprocessorInfoChannel getPreprocessorInfoChannel() - { - return preprocessorInfoChannel; - } - - public void setPreprocessingDirective(String pre) - { - preprocessorInfoChannel.addLineForTokenNumber( pre, new Integer(tokenNumber) ); - } - - protected Token makeToken(int t) - { - if ( t != Token.SKIP && countingTokens) { - tokenNumber++; - } - CToken tok = (CToken) super.makeToken(t); - tok.setLine(lineObject.line); - tok.setSource(lineObject.source); - tok.setTokenNumber(tokenNumber); - - lineObject.line += deferredLineCount; - deferredLineCount = 0; - return tok; - } - - public void deferredNewline() { - deferredLineCount++; - } - - public void newline() { - lineObject.newline(); - } - - - - - - -} -Whitespace :( ( ' ' | '\t' | '\014') - | "\r\n" { newline(); } - | ( '\n' | '\r' ) { newline(); } - ) { _ttype = Token.SKIP; } - ; - -protected Escape :'\\' - ( options{warnWhenFollowAmbig=false;}: - ~('0'..'7' | 'x') - | ('0'..'3') ( options{warnWhenFollowAmbig=false;}: Digit )* - | ('4'..'7') ( options{warnWhenFollowAmbig=false;}: Digit )* - | 'x' ( options{warnWhenFollowAmbig=false;}: Digit | 'a'..'f' | 'A'..'F' )+ - ) - ; - -protected IntSuffix :'L' - | 'l' - | 'U' - | 'u' - | 'I' - | 'i' - | 'J' - | 'j' - ; - -protected NumberSuffix :IntSuffix - | 'F' - | 'f' - ; - -Number :( ( Digit )+ ( '.' | 'e' | 'E' ) )=> ( Digit )+ - ( '.' ( Digit )* ( Exponent )? - | Exponent - ) - ( NumberSuffix - )* - - | ( "..." )=> "..." { _ttype = VARARGS; } - - | '.' { _ttype = DOT; } - ( ( Digit )+ ( Exponent )? - { _ttype = Number; } - ( NumberSuffix - )* - )? - - | '0' ( '0'..'7' )* - ( NumberSuffix - )* - - | '1'..'9' ( Digit )* - ( NumberSuffix - )* - - | '0' ( 'x' | 'X' ) ( 'a'..'f' | 'A'..'F' | Digit )+ - ( IntSuffix - )* - ; - -IDMEAT :i:ID { - - if ( i.getType() == LITERAL___extension__ ) { - $setType(Token.SKIP); - } - else { - $setType(i.getType()); - } - - } - ; - -protected ID -options { - testLiterals= true; -} -:( 'a'..'z' | 'A'..'Z' | '_' | '$') - ( 'a'..'z' | 'A'..'Z' | '_' | '$' | '0'..'9' )* - ; - -WideCharLiteral :'L' CharLiteral - { $setType(CharLiteral); } - ; - -WideStringLiteral :'L' StringLiteral - { $setType(StringLiteral); } - ; - -StringLiteral :'"' - ( ('\\' ~('\n'))=> Escape - | ( '\r' { newline(); } - | '\n' { - newline(); - } - | '\\' '\n' { - newline(); - } - ) - | ~( '"' | '\r' | '\n' | '\\' ) - )* - '"' - ; - -// inherited from grammar StdCLexer -protected Vocabulary :'\3'..'\377' - ; - -// inherited from grammar StdCLexer -ASSIGN :'=' ; - -// inherited from grammar StdCLexer -COLON :':' ; - -// inherited from grammar StdCLexer -COMMA :',' ; - -// inherited from grammar StdCLexer -QUESTION :'?' ; - -// inherited from grammar StdCLexer -SEMI :';' ; - -// inherited from grammar StdCLexer -PTR :"->" ; - -// inherited from grammar StdCLexer -protected DOT :; - -// inherited from grammar StdCLexer -protected VARARGS :; - -// inherited from grammar StdCLexer -LPAREN :'(' ; - -// inherited from grammar StdCLexer -RPAREN :')' ; - -// inherited from grammar StdCLexer -LBRACKET :'[' ; - -// inherited from grammar StdCLexer -RBRACKET :']' ; - -// inherited from grammar StdCLexer -LCURLY :'{' ; - -// inherited from grammar StdCLexer -RCURLY :'}' ; - -// inherited from grammar StdCLexer -EQUAL :"==" ; - -// inherited from grammar StdCLexer -NOT_EQUAL :"!=" ; - -// inherited from grammar StdCLexer -LTE :"<=" ; - -// inherited from grammar StdCLexer -LT :"<" ; - -// inherited from grammar StdCLexer -GTE :">=" ; - -// inherited from grammar StdCLexer -GT :">" ; - -// inherited from grammar StdCLexer -DIV :'/' ; - -// inherited from grammar StdCLexer -DIV_ASSIGN :"/=" ; - -// inherited from grammar StdCLexer -PLUS :'+' ; - -// inherited from grammar StdCLexer -PLUS_ASSIGN :"+=" ; - -// inherited from grammar StdCLexer -INC :"++" ; - -// inherited from grammar StdCLexer -MINUS :'-' ; - -// inherited from grammar StdCLexer -MINUS_ASSIGN :"-=" ; - -// inherited from grammar StdCLexer -DEC :"--" ; - -// inherited from grammar StdCLexer -STAR :'*' ; - -// inherited from grammar StdCLexer -STAR_ASSIGN :"*=" ; - -// inherited from grammar StdCLexer -MOD :'%' ; - -// inherited from grammar StdCLexer -MOD_ASSIGN :"%=" ; - -// inherited from grammar StdCLexer -RSHIFT :">>" ; - -// inherited from grammar StdCLexer -RSHIFT_ASSIGN :">>=" ; - -// inherited from grammar StdCLexer -LSHIFT :"<<" ; - -// inherited from grammar StdCLexer -LSHIFT_ASSIGN :"<<=" ; - -// inherited from grammar StdCLexer -LAND :"&&" ; - -// inherited from grammar StdCLexer -LNOT :'!' ; - -// inherited from grammar StdCLexer -LOR :"||" ; - -// inherited from grammar StdCLexer -BAND :'&' ; - -// inherited from grammar StdCLexer -BAND_ASSIGN :"&=" ; - -// inherited from grammar StdCLexer -BNOT :'~' ; - -// inherited from grammar StdCLexer -BOR :'|' ; - -// inherited from grammar StdCLexer -BOR_ASSIGN :"|=" ; - -// inherited from grammar StdCLexer -BXOR :'^' ; - -// inherited from grammar StdCLexer -BXOR_ASSIGN :"^=" ; - -// inherited from grammar StdCLexer -Comment :"/*" - ( { LA(2) != '/' }? '*' - | "\r\n" { deferredNewline(); } - | ( '\r' | '\n' ) { deferredNewline(); } - | ~( '*'| '\r' | '\n' ) - )* - "*/" { _ttype = Token.SKIP; - } - ; - -// inherited from grammar StdCLexer -CPPComment :"//" ( ~('\n') )* - { - _ttype = Token.SKIP; - } - ; - -// inherited from grammar StdCLexer -PREPROC_DIRECTIVE -options { - paraphrase= "a line directive"; -} -:'#' - ( ( "line" || (( ' ' | '\t' | '\014')+ '0'..'9')) => LineDirective - | (~'\n')* { setPreprocessingDirective(getText()); } - ) - { - _ttype = Token.SKIP; - } - ; - -// inherited from grammar StdCLexer -protected Space :( ' ' | '\t' | '\014') - ; - -// inherited from grammar StdCLexer -protected LineDirective { - boolean oldCountingTokens = countingTokens; - countingTokens = false; -} -:{ - lineObject = new LineObject(); - deferredLineCount = 0; - } - ("line")? //this would be for if the directive started "#line", but not there for GNU directives - (Space)+ - n:Number { lineObject.setLine(Integer.parseInt(n.getText())); } - (Space)+ - ( fn:StringLiteral { try { - lineObject.setSource(fn.getText().substring(1,fn.getText().length()-1)); - } - catch (StringIndexOutOfBoundsException e) { /*not possible*/ } - } - | fi:ID { lineObject.setSource(fi.getText()); } - )? - (Space)* - ("1" { lineObject.setEnteringFile(true); } )? - (Space)* - ("2" { lineObject.setReturningToFile(true); } )? - (Space)* - ("3" { lineObject.setSystemHeader(true); } )? - (Space)* - ("4" { lineObject.setTreatAsC(true); } )? - (~('\r' | '\n'))* - ("\r\n" | "\r" | "\n") - { - preprocessorInfoChannel.addLineForTokenNumber(new LineObject(lineObject), new Integer(tokenNumber)); - countingTokens = oldCountingTokens; - } - ; - -// inherited from grammar StdCLexer -CharLiteral :'\'' ( Escape | ~( '\'' ) ) '\'' - ; - -// inherited from grammar StdCLexer -protected BadStringLiteral :// Imaginary token. - ; - -// inherited from grammar StdCLexer -protected Digit :'0'..'9' - ; - -// inherited from grammar StdCLexer -protected LongSuffix :'l' - | 'L' - ; - -// inherited from grammar StdCLexer -protected UnsignedSuffix :'u' - | 'U' - ; - -// inherited from grammar StdCLexer -protected FloatSuffix :'f' - | 'F' - ; - -// inherited from grammar StdCLexer -protected Exponent :( 'e' | 'E' ) ( '+' | '-' )? ( Digit )+ - ; - -// inherited from grammar StdCLexer -protected DoubleDoubleConst :; - -// inherited from grammar StdCLexer -protected FloatDoubleConst :; - -// inherited from grammar StdCLexer -protected LongDoubleConst :; - -// inherited from grammar StdCLexer -protected IntOctalConst :; - -// inherited from grammar StdCLexer -protected LongOctalConst :; - -// inherited from grammar StdCLexer -protected UnsignedOctalConst :; - -// inherited from grammar StdCLexer -protected IntIntConst :; - -// inherited from grammar StdCLexer -protected LongIntConst :; - -// inherited from grammar StdCLexer -protected UnsignedIntConst :; - -// inherited from grammar StdCLexer -protected IntHexConst :; - -// inherited from grammar StdCLexer -protected LongHexConst :; - -// inherited from grammar StdCLexer -protected UnsignedHexConst :; - - diff --git a/app/preproc/whitespace_test.pde b/app/preproc/whitespace_test.pde deleted file mode 100755 index e13c45fce..000000000 --- a/app/preproc/whitespace_test.pde +++ /dev/null @@ -1,150 +0,0 @@ -// this is a whitespace and other invisible token torture test for the ANTLR-based -// preprocessor. edit pde.properties and set "editor.save_build_files" to true. -// then, build this in processing. next, use -// -// diff -u --strip-trailing-cr \ -// work/sketchbook/default/whitespace_test/whitespace_test.pde \ -// work/lib/build/MyDemo.java -// -// to compare the files before and after preprocessing. There should not be -// any differences. - -import // comment test - java.io.*; - -// comment 1 -public class // post-class comment - -// comment2 - -MyDemo extends BApplet implements // foo - java.lang. // bar - Cloneable { - - //argh - - public // foo - String // bar - fff = /*rheet */ "stuff"; - - static /*a*/ { - /*foo*/ - /*bar*/ - six = 6; - } /* b*/ - - static /*a*/ final /*b*/ int six; - - void setup() - { - size(200, 200); - background(255); - - this . fff = /* ook */ (String)/*foo*/"yo"; - rectMode(CENTER_DIAMETER); // comment 1a - noStroke(); - fill(255, 204, 0); - - int q = /*a*/ - /*b*/ 1; - - boolean c = /*a*/ ! /*b*/ true; - } - - int foo() /*a*/ throws /*b*/ java.lang.Exception /*c*/ - { - int b = 7; - switch /*a*/ ( /*b*/ b /*c*/ ) { - case /*d*/ 1 /*e*/: /*f*/ - int c=9; - /*g*/ - break; /*h*/ - default /*i*/ : - int d=9; - break; - } - - try { /* qq */ - loop(); /* rr */ - } catch /*ss*/ (java.lang.Exception ex) /*tt*/ { - b = 8; /*tut*/ - throw /*utu*/ ex; - } /*uu*/ finally /*vv*/ { - b = 9; - } /*ww*/ - - b /*aaa*/ = /*bbb*/ true /*ccc*/ ? /*ddd*/ 0 /*eee*/ - : /* fff*/ 1 /*ggg*/; - return /*a*/ 5 /*b*/; - } - - // comment 2 - void loop() - { - - int arr1 /* VVV */ [ /* XXX */] /*YYY*/ ; - int[] arr2 = { /*a*/ 2, 3 /*b*/ } /*c*/ ; - - for /*a*/ (/*b*/ int j=0 /*c*/; /*d*/ j<2/*e*/ ; /*f*/ j++ /*g*/) - /*h*/ - arr2[1] = 6; - - /*foo*/ - ; - /*bar*/ - rect(width-mouseX, height-mouseY, 50, 50); - rect(mouseX, mouseY, 50, 50); - - if (/*a*/ arr2[1] == 6/*b*/) { - /*c*/ - int d=7; - } /*d*/else /*e*/{ - int e=8; - /*f*/ - } - - int f; - if (/*aa*/ arr2[1] ==6 /*bb*/ ) - /*cc*/ - f=8; /*dd*/ - else /*ee*/ - f=10; /*ff*/ - - while ( /*aaa*/ f < 15) /*bbb*/ { - f ++; - } /*ggg*/ - - do /* aaaa */ { - f++; - } /*bbbb*/ while /*cccc*/ ( /*a*/ - /*b*/ 20 > f) /*dddd*/; - - f = 2 * 3 + 4; - - f = ( 2 * 3 ) + 4 + /*aa*/ -/*bb*/1; - - f = 2 * ( 3 + 4 ) ; - - fff = /*a*/ new /*b*/ String(/*c*/"foo"/*d*/) /*e*/; - - int arr3[] = /*a*/ new /*b*/ int/*c*/[/*d*/] /*e*/ {1/*f*/,2}; - int arr4[][] = new /*a*/int/*b*/[1][2]/*c*/; - - } - - class Shoe - { - Shoe(String brand) - { - println(brand); - } - } - - class NikeAir extends Shoe - { - NikeAir() - { - /*a*/ super /*b*/ ( /*c*/ "Nike" /*d*/ ) /*e*/ ; - - /*aa*/ ( /*bb*/ new /*cc*/ MyDemo /*dd*/ (/*ee*/)/*ff*/)/*gg*/./*hh*/super/*ii*/(/*jj*/5/*kk*/); - } - } -} diff --git a/build/macosx/Arduino.xcodeproj/project.pbxproj b/build/macosx/Arduino.xcodeproj/project.pbxproj index 32724f892..daebd8b6e 100644 --- a/build/macosx/Arduino.xcodeproj/project.pbxproj +++ b/build/macosx/Arduino.xcodeproj/project.pbxproj @@ -88,7 +88,6 @@ 33FF070C0965BF760016AC38 /* CopyFiles */, 33FF07130965BFA80016AC38 /* CopyFiles */, 336EA3E309FF84FA0052D765 /* CopyFiles */, - 33FF071D0965C1C20016AC38 /* CopyFiles */, 33FF07170965BFFE0016AC38 /* ShellScript */, ); dependencies = ( @@ -107,7 +106,7 @@ 33AF61650965C4C600B514A9 /* Resources */, 33AF61660965C4C600B514A9 /* JavaArchive */, 33AF61670965C4C600B514A9 /* Frameworks */, - 33CF03C809662DA200F2C9A9 /* CopyFiles */, + 33CF03C809662DA200F2C9A9 /* Copy Java Resources */, ); dependencies = ( ); @@ -128,7 +127,7 @@ CFBundleIconFile arduino.icns CFBundleIdentifier - + cc.arduino.Arduino CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -161,6 +160,8 @@ apple.laf.useScreenMenuBar true + arduino.app-resources + $APP_PACKAGE/Contents/Resources @@ -172,8 +173,8 @@ /* Begin PBXBuildFile section */ 33055EFF0CB8187700824CD9 /* SerialException.java in Sources */ = {isa = PBXBuildFile; fileRef = 33055EFE0CB8187600824CD9 /* SerialException.java */; }; 332D4DB609CF147F00BF81F6 /* Sizer.java in Sources */ = {isa = PBXBuildFile; fileRef = 332D4DB509CF147F00BF81F6 /* Sizer.java */; }; - 335A28F50C8CCB0A00D8A7F4 /* quaqua.jar in CopyFiles */ = {isa = PBXBuildFile; fileRef = 335A28F30C8CCAF700D8A7F4 /* quaqua.jar */; }; - 335A28FE0C8CCB4000D8A7F4 /* libquaqua.jnilib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 335A28F20C8CCAF700D8A7F4 /* libquaqua.jnilib */; }; + 335A28F50C8CCB0A00D8A7F4 /* quaqua.jar in Copy Java Resources */ = {isa = PBXBuildFile; fileRef = 335A28F30C8CCAF700D8A7F4 /* quaqua.jar */; }; + 335A28FE0C8CCB4000D8A7F4 /* libquaqua.jnilib in Copy Java Resources */ = {isa = PBXBuildFile; fileRef = 335A28F20C8CCAF700D8A7F4 /* libquaqua.jnilib */; }; 335A29140C8CCC0900D8A7F4 /* PApplet.java in Sources */ = {isa = PBXBuildFile; fileRef = 335A29070C8CCC0900D8A7F4 /* PApplet.java */; }; 335A29150C8CCC0900D8A7F4 /* PConstants.java in Sources */ = {isa = PBXBuildFile; fileRef = 335A29080C8CCC0900D8A7F4 /* PConstants.java */; }; 335A29160C8CCC0900D8A7F4 /* PFont.java in Sources */ = {isa = PBXBuildFile; fileRef = 335A29090C8CCC0900D8A7F4 /* PFont.java */; }; @@ -192,12 +193,9 @@ 3383C03B0CB7CAF400A8FB57 /* hardware in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3383BF8B0CB7C71200A8FB57 /* hardware */; }; 338C478A0AA204BE008F2C0D /* FTDIUSBSerialDriver_v2_1_6.dmg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 338C47870AA204B0008F2C0D /* FTDIUSBSerialDriver_v2_1_6.dmg */; }; 338C478B0AA204BE008F2C0D /* FTDIUSBSerialDriver_v2_2_6_Intel.dmg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 338C47880AA204B0008F2C0D /* FTDIUSBSerialDriver_v2_2_6_Intel.dmg */; }; - 339514EE097AEB5900193C89 /* STDCTokenTypes.txt in Resources */ = {isa = PBXBuildFile; fileRef = 33FFFE420965BD110016AC38 /* STDCTokenTypes.txt */; }; 339514FA097AEB8000193C89 /* license.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF02B60965BD170016AC38 /* license.txt */; }; 339514FB097AEB8000193C89 /* readme.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF02B70965BD170016AC38 /* readme.txt */; }; - 33AF61760965C54B00B514A9 /* PreprocessorInfoChannel.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE3D0965BD110016AC38 /* PreprocessorInfoChannel.java */; }; 33AF61770965C54B00B514A9 /* EditorListener.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE2C0965BD110016AC38 /* EditorListener.java */; }; - 33AF61780965C54B00B514A9 /* LineObject.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE3A0965BD110016AC38 /* LineObject.java */; }; 33AF61790965C54B00B514A9 /* Serial.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE590965BD110016AC38 /* Serial.java */; }; 33AF617A0965C54B00B514A9 /* TextUtilities.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE6D0965BD110016AC38 /* TextUtilities.java */; }; 33AF617B0965C54B00B514A9 /* EditorConsole.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE290965BD110016AC38 /* EditorConsole.java */; }; @@ -211,50 +209,34 @@ 33AF61830965C54B00B514A9 /* SyntaxStyle.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE690965BD110016AC38 /* SyntaxStyle.java */; }; 33AF61840965C54B00B514A9 /* Uploader.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE740965BD110016AC38 /* Uploader.java */; }; 33AF61850965C54B00B514A9 /* RunnerException.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE580965BD110016AC38 /* RunnerException.java */; }; - 33AF61860965C54B00B514A9 /* WParser.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE4E0965BD110016AC38 /* WParser.java */; }; 33AF61870965C54B00B514A9 /* TextAreaPainter.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE6C0965BD110016AC38 /* TextAreaPainter.java */; }; 33AF61880965C54B00B514A9 /* Sketchbook.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE5B0965BD110016AC38 /* Sketchbook.java */; }; 33AF61890965C54B00B514A9 /* EditorStatus.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE2D0965BD110016AC38 /* EditorStatus.java */; }; - 33AF618A0965C54B00B514A9 /* WTokenTypes.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE4F0965BD110016AC38 /* WTokenTypes.java */; }; 33AF618B0965C54B00B514A9 /* TextAreaDefaults.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE6B0965BD110016AC38 /* TextAreaDefaults.java */; }; 33AF618C0965C54B00B514A9 /* PdePreprocessor.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE3C0965BD110016AC38 /* PdePreprocessor.java */; }; - 33AF618D0965C54B00B514A9 /* CSymbolTable.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE350965BD110016AC38 /* CSymbolTable.java */; }; 33AF618E0965C54B00B514A9 /* SketchHistory.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE5D0965BD110016AC38 /* SketchHistory.java */; }; 33AF618F0965C54B00B514A9 /* RunnerClassLoader.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE570965BD110016AC38 /* RunnerClassLoader.java */; }; 33AF61900965C54B00B514A9 /* MessageStream.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE320965BD110016AC38 /* MessageStream.java */; }; 33AF61910965C54B00B514A9 /* SyntaxUtilities.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE6A0965BD110016AC38 /* SyntaxUtilities.java */; }; 33AF61930965C54B00B514A9 /* PresentMode.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE550965BD110016AC38 /* PresentMode.java */; }; - 33AF61940965C54B00B514A9 /* STDCTokenTypes.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE410965BD110016AC38 /* STDCTokenTypes.java */; }; 33AF61950965C54B00B514A9 /* CTokenMarker.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE600965BD110016AC38 /* CTokenMarker.java */; }; - 33AF61960965C54B00B514A9 /* CToken.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE360965BD110016AC38 /* CToken.java */; }; - 33AF61970965C54B00B514A9 /* WTreeParserTokenTypes.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE530965BD110016AC38 /* WTreeParserTokenTypes.java */; }; 33AF61990965C54B00B514A9 /* Runner.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE560965BD110016AC38 /* Runner.java */; }; - 33AF619A0965C54B00B514A9 /* TNode.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE430965BD110016AC38 /* TNode.java */; }; 33AF619B0965C54B00B514A9 /* KeywordMap.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE640965BD110016AC38 /* KeywordMap.java */; }; - 33AF619C0965C54B00B514A9 /* ExtendedCommonASTWithHiddenTokens.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE390965BD110016AC38 /* ExtendedCommonASTWithHiddenTokens.java */; }; 33AF619D0965C54B00B514A9 /* Sketch.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE5A0965BD110016AC38 /* Sketch.java */; }; - 33AF619E0965C54B00B514A9 /* WEmitterTokenTypes.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE470965BD110016AC38 /* WEmitterTokenTypes.java */; }; - 33AF619F0965C54B00B514A9 /* TNodeFactory.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE440965BD110016AC38 /* TNodeFactory.java */; }; 33AF61A00965C54B00B514A9 /* Target.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE700965BD110016AC38 /* Target.java */; }; 33AF61A10965C54B00B514A9 /* UpdateCheck.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE730965BD110016AC38 /* UpdateCheck.java */; }; 33AF61A20965C54B00B514A9 /* InputHandler.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE620965BD110016AC38 /* InputHandler.java */; }; 33AF61A30965C54B00B514A9 /* MessageConsumer.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE300965BD110016AC38 /* MessageConsumer.java */; }; - 33AF61A40965C54B00B514A9 /* WLexer.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE4A0965BD110016AC38 /* WLexer.java */; }; 33AF61A50965C54B00B514A9 /* Compiler.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE260965BD100016AC38 /* Compiler.java */; }; 33AF61A60965C54B00B514A9 /* AutoFormat.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE720965BD110016AC38 /* AutoFormat.java */; }; - 33AF61A70965C54B00B514A9 /* StdCLexer.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE3E0965BD110016AC38 /* StdCLexer.java */; }; - 33AF61A80965C54B00B514A9 /* StdCParser.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE400965BD110016AC38 /* StdCParser.java */; }; 33AF61A90965C54B00B514A9 /* PdeKeywords.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE650965BD110016AC38 /* PdeKeywords.java */; }; 33AF61AA0965C54B00B514A9 /* Editor.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE270965BD100016AC38 /* Editor.java */; }; - 33AF61AB0965C54B00B514A9 /* WEmitter.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE460965BD110016AC38 /* WEmitter.java */; }; 33AF61AC0965C54B00B514A9 /* SwingWorker.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE5E0965BD110016AC38 /* SwingWorker.java */; }; 33AF61AD0965C54B00B514A9 /* DefaultInputHandler.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE610965BD110016AC38 /* DefaultInputHandler.java */; }; 33AF61AE0965C54B00B514A9 /* SyntaxDocument.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE680965BD110016AC38 /* SyntaxDocument.java */; }; - 33AF61AF0965C54B00B514A9 /* WLexerTokenTypes.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE4B0965BD110016AC38 /* WLexerTokenTypes.java */; }; 33AF61B00965C54B00B514A9 /* Token.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE6E0965BD110016AC38 /* Token.java */; }; 33AF61B10965C54B00B514A9 /* Preferences.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE330965BD110016AC38 /* Preferences.java */; }; 33AF61B20965C54B00B514A9 /* PdeTextAreaDefaults.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE660965BD110016AC38 /* PdeTextAreaDefaults.java */; }; - 33AF61B30965C54B00B514A9 /* WTreeParser.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE520965BD110016AC38 /* WTreeParser.java */; }; 33AF61B40965C54B00B514A9 /* JEditTextArea.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE630965BD110016AC38 /* JEditTextArea.java */; }; 33AF61B50965C54B00B514A9 /* Base.java in Sources */ = {isa = PBXBuildFile; fileRef = 33FFFE240965BD100016AC38 /* Base.java */; }; 33BEDDB209D6DC1300430D5B /* LibraryManager.java in Sources */ = {isa = PBXBuildFile; fileRef = 33BEDDB009D6DC1300430D5B /* LibraryManager.java */; }; @@ -262,28 +244,30 @@ 33BEDDD609D6E8D800430D5B /* ExportFolder.java in Sources */ = {isa = PBXBuildFile; fileRef = 33BEDDD409D6E8D800430D5B /* ExportFolder.java */; }; 33BEE0CE09D7446100430D5B /* Library.java in Sources */ = {isa = PBXBuildFile; fileRef = 33BEE0CD09D7446100430D5B /* Library.java */; }; 33CF03B209662CB700F2C9A9 /* arduino.icns in Resources */ = {isa = PBXBuildFile; fileRef = 33CF03B009662CA800F2C9A9 /* arduino.icns */; }; - 33CF03CC09662DC000F2C9A9 /* mrj.jar in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33AF620C0965D67900B514A9 /* mrj.jar */; settings = {JAVA_ARCHIVE_SUBDIR = ../shared/lib; }; }; - 33CF03CD09662DC000F2C9A9 /* RXTXcomm.jar in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33AF620F0965D67A00B514A9 /* RXTXcomm.jar */; settings = {JAVA_ARCHIVE_SUBDIR = ../shared/lib; }; }; - 33CF03CE09662DC000F2C9A9 /* antlr.jar in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33AF620A0965D67800B514A9 /* antlr.jar */; settings = {JAVA_ARCHIVE_SUBDIR = ../shared/lib; }; }; - 33CF03CF09662DC000F2C9A9 /* registry.jar in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33AF620E0965D67A00B514A9 /* registry.jar */; settings = {JAVA_ARCHIVE_SUBDIR = ../shared/lib; }; }; - 33CF03D009662DC000F2C9A9 /* oro.jar in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33AF620D0965D67900B514A9 /* oro.jar */; settings = {JAVA_ARCHIVE_SUBDIR = ../shared/lib; }; }; + 33CF03CC09662DC000F2C9A9 /* mrj.jar in Copy Java Resources */ = {isa = PBXBuildFile; fileRef = 33AF620C0965D67900B514A9 /* mrj.jar */; settings = {JAVA_ARCHIVE_SUBDIR = ../shared/lib; }; }; + 33CF03CD09662DC000F2C9A9 /* RXTXcomm.jar in Copy Java Resources */ = {isa = PBXBuildFile; fileRef = 33AF620F0965D67A00B514A9 /* RXTXcomm.jar */; settings = {JAVA_ARCHIVE_SUBDIR = ../shared/lib; }; }; + 33CF03CE09662DC000F2C9A9 /* antlr.jar in Copy Java Resources */ = {isa = PBXBuildFile; fileRef = 33AF620A0965D67800B514A9 /* antlr.jar */; settings = {JAVA_ARCHIVE_SUBDIR = ../shared/lib; }; }; + 33CF03CF09662DC000F2C9A9 /* registry.jar in Copy Java Resources */ = {isa = PBXBuildFile; fileRef = 33AF620E0965D67A00B514A9 /* registry.jar */; settings = {JAVA_ARCHIVE_SUBDIR = ../shared/lib; }; }; + 33CF03D009662DC000F2C9A9 /* oro.jar in Copy Java Resources */ = {isa = PBXBuildFile; fileRef = 33AF620D0965D67900B514A9 /* oro.jar */; settings = {JAVA_ARCHIVE_SUBDIR = ../shared/lib; }; }; 33F944E10C2B33560093EB9C /* AvrdudeUploader.java in Sources */ = {isa = PBXBuildFile; fileRef = 33F944E00C2B33560093EB9C /* AvrdudeUploader.java */; }; 33FF07100965BF8A0016AC38 /* burn.command in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FFFEAF0965BD110016AC38 /* burn.command */; }; - 33FF071F0965C1E30016AC38 /* about.jpg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF01DE0965BD160016AC38 /* about.jpg */; }; - 33FF07220965C1E30016AC38 /* buttons.gif in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF02770965BD160016AC38 /* buttons.gif */; }; - 33FF07230965C1E30016AC38 /* icon.gif in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF02780965BD160016AC38 /* icon.gif */; }; - 33FF07240965C1E30016AC38 /* keywords.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF02790965BD160016AC38 /* keywords.txt */; }; - 33FF07250965C1E30016AC38 /* loading.gif in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF027A0965BD160016AC38 /* loading.gif */; }; - 33FF07280965C1E30016AC38 /* preferences.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF027D0965BD160016AC38 /* preferences.txt */; }; - 33FF072A0965C1E30016AC38 /* resize.gif in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF027F0965BD160016AC38 /* resize.gif */; }; - 33FF072C0965C1E30016AC38 /* tab-sel-left.gif in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF02810965BD160016AC38 /* tab-sel-left.gif */; }; - 33FF072D0965C1E30016AC38 /* tab-sel-menu.gif in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF02820965BD160016AC38 /* tab-sel-menu.gif */; }; - 33FF072E0965C1E30016AC38 /* tab-sel-mid.gif in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF02830965BD160016AC38 /* tab-sel-mid.gif */; }; - 33FF072F0965C1E30016AC38 /* tab-sel-right.gif in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF02840965BD160016AC38 /* tab-sel-right.gif */; }; - 33FF07300965C1E30016AC38 /* tab-unsel-left.gif in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF02850965BD160016AC38 /* tab-unsel-left.gif */; }; - 33FF07310965C1E30016AC38 /* tab-unsel-menu.gif in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF02860965BD160016AC38 /* tab-unsel-menu.gif */; }; - 33FF07320965C1E30016AC38 /* tab-unsel-mid.gif in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF02870965BD160016AC38 /* tab-unsel-mid.gif */; }; - 33FF07330965C1E30016AC38 /* tab-unsel-right.gif in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33FF02880965BD160016AC38 /* tab-unsel-right.gif */; }; + 33FF071F0965C1E30016AC38 /* about.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 33FF01DE0965BD160016AC38 /* about.jpg */; }; + 33FF07220965C1E30016AC38 /* buttons.gif in Resources */ = {isa = PBXBuildFile; fileRef = 33FF02770965BD160016AC38 /* buttons.gif */; }; + 33FF07230965C1E30016AC38 /* icon.gif in Resources */ = {isa = PBXBuildFile; fileRef = 33FF02780965BD160016AC38 /* icon.gif */; }; + 33FF07240965C1E30016AC38 /* keywords.txt in Resources */ = {isa = PBXBuildFile; fileRef = 33FF02790965BD160016AC38 /* keywords.txt */; }; + 33FF07250965C1E30016AC38 /* loading.gif in Resources */ = {isa = PBXBuildFile; fileRef = 33FF027A0965BD160016AC38 /* loading.gif */; }; + 33FF07280965C1E30016AC38 /* preferences.txt in Resources */ = {isa = PBXBuildFile; fileRef = 33FF027D0965BD160016AC38 /* preferences.txt */; }; + 33FF072A0965C1E30016AC38 /* resize.gif in Resources */ = {isa = PBXBuildFile; fileRef = 33FF027F0965BD160016AC38 /* resize.gif */; }; + 33FF072C0965C1E30016AC38 /* tab-sel-left.gif in Resources */ = {isa = PBXBuildFile; fileRef = 33FF02810965BD160016AC38 /* tab-sel-left.gif */; }; + 33FF072D0965C1E30016AC38 /* tab-sel-menu.gif in Resources */ = {isa = PBXBuildFile; fileRef = 33FF02820965BD160016AC38 /* tab-sel-menu.gif */; }; + 33FF072E0965C1E30016AC38 /* tab-sel-mid.gif in Resources */ = {isa = PBXBuildFile; fileRef = 33FF02830965BD160016AC38 /* tab-sel-mid.gif */; }; + 33FF072F0965C1E30016AC38 /* tab-sel-right.gif in Resources */ = {isa = PBXBuildFile; fileRef = 33FF02840965BD160016AC38 /* tab-sel-right.gif */; }; + 33FF07300965C1E30016AC38 /* tab-unsel-left.gif in Resources */ = {isa = PBXBuildFile; fileRef = 33FF02850965BD160016AC38 /* tab-unsel-left.gif */; }; + 33FF07310965C1E30016AC38 /* tab-unsel-menu.gif in Resources */ = {isa = PBXBuildFile; fileRef = 33FF02860965BD160016AC38 /* tab-unsel-menu.gif */; }; + 33FF07320965C1E30016AC38 /* tab-unsel-mid.gif in Resources */ = {isa = PBXBuildFile; fileRef = 33FF02870965BD160016AC38 /* tab-unsel-mid.gif */; }; + 33FF07330965C1E30016AC38 /* tab-unsel-right.gif in Resources */ = {isa = PBXBuildFile; fileRef = 33FF02880965BD160016AC38 /* tab-unsel-right.gif */; }; + A337296F0D22505C00E82412 /* librxtxSerial.jnilib in Copy Java Resources */ = {isa = PBXBuildFile; fileRef = A33729630D224FA700E82412 /* librxtxSerial.jnilib */; }; + A3688DF40D284554003CBAA1 /* applet.html in Resources */ = {isa = PBXBuildFile; fileRef = 33AF620B0965D67900B514A9 /* applet.html */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -366,19 +350,22 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 33CF03C809662DA200F2C9A9 /* CopyFiles */ = { + 33CF03C809662DA200F2C9A9 /* Copy Java Resources */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 15; files = ( - 335A28F50C8CCB0A00D8A7F4 /* quaqua.jar in CopyFiles */, - 33CF03CC09662DC000F2C9A9 /* mrj.jar in CopyFiles */, - 33CF03CD09662DC000F2C9A9 /* RXTXcomm.jar in CopyFiles */, - 33CF03CE09662DC000F2C9A9 /* antlr.jar in CopyFiles */, - 33CF03CF09662DC000F2C9A9 /* registry.jar in CopyFiles */, - 33CF03D009662DC000F2C9A9 /* oro.jar in CopyFiles */, + 335A28F50C8CCB0A00D8A7F4 /* quaqua.jar in Copy Java Resources */, + 33CF03CC09662DC000F2C9A9 /* mrj.jar in Copy Java Resources */, + 33CF03CD09662DC000F2C9A9 /* RXTXcomm.jar in Copy Java Resources */, + 33CF03CE09662DC000F2C9A9 /* antlr.jar in Copy Java Resources */, + 33CF03CF09662DC000F2C9A9 /* registry.jar in Copy Java Resources */, + 33CF03D009662DC000F2C9A9 /* oro.jar in Copy Java Resources */, + 335A28FE0C8CCB4000D8A7F4 /* libquaqua.jnilib in Copy Java Resources */, + A337296F0D22505C00E82412 /* librxtxSerial.jnilib in Copy Java Resources */, ); + name = "Copy Java Resources"; runOnlyForDeploymentPostprocessing = 0; }; 33FF070C0965BF760016AC38 /* CopyFiles */ = { @@ -402,37 +389,12 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 33FF071D0965C1C20016AC38 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = lib; - dstSubfolderSpec = 16; - files = ( - 33FF071F0965C1E30016AC38 /* about.jpg in CopyFiles */, - 33FF07220965C1E30016AC38 /* buttons.gif in CopyFiles */, - 33FF07230965C1E30016AC38 /* icon.gif in CopyFiles */, - 33FF07240965C1E30016AC38 /* keywords.txt in CopyFiles */, - 33FF07250965C1E30016AC38 /* loading.gif in CopyFiles */, - 33FF07280965C1E30016AC38 /* preferences.txt in CopyFiles */, - 33FF072A0965C1E30016AC38 /* resize.gif in CopyFiles */, - 33FF072C0965C1E30016AC38 /* tab-sel-left.gif in CopyFiles */, - 33FF072D0965C1E30016AC38 /* tab-sel-menu.gif in CopyFiles */, - 33FF072E0965C1E30016AC38 /* tab-sel-mid.gif in CopyFiles */, - 33FF072F0965C1E30016AC38 /* tab-sel-right.gif in CopyFiles */, - 33FF07300965C1E30016AC38 /* tab-unsel-left.gif in CopyFiles */, - 33FF07310965C1E30016AC38 /* tab-unsel-menu.gif in CopyFiles */, - 33FF07320965C1E30016AC38 /* tab-unsel-mid.gif in CopyFiles */, - 33FF07330965C1E30016AC38 /* tab-unsel-right.gif in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 33FFFE1D0965BC050016AC38 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 16; files = ( - 335A28FE0C8CCB4000D8A7F4 /* libquaqua.jnilib in CopyFiles */, 339514FA097AEB8000193C89 /* license.txt in CopyFiles */, 339514FB097AEB8000193C89 /* readme.txt in CopyFiles */, ); @@ -509,38 +471,7 @@ 33FFFE310965BD110016AC38 /* MessageSiphon.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = MessageSiphon.java; sourceTree = ""; }; 33FFFE320965BD110016AC38 /* MessageStream.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = MessageStream.java; sourceTree = ""; }; 33FFFE330965BD110016AC38 /* Preferences.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = Preferences.java; sourceTree = ""; }; - 33FFFE350965BD110016AC38 /* CSymbolTable.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = CSymbolTable.java; sourceTree = ""; }; - 33FFFE360965BD110016AC38 /* CToken.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = CToken.java; sourceTree = ""; }; - 33FFFE370965BD110016AC38 /* expandedWEmitter.g */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = expandedWEmitter.g; sourceTree = ""; }; - 33FFFE380965BD110016AC38 /* expandedWParser.g */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = expandedWParser.g; sourceTree = ""; }; - 33FFFE390965BD110016AC38 /* ExtendedCommonASTWithHiddenTokens.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = ExtendedCommonASTWithHiddenTokens.java; sourceTree = ""; }; - 33FFFE3A0965BD110016AC38 /* LineObject.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = LineObject.java; sourceTree = ""; }; - 33FFFE3B0965BD110016AC38 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; 33FFFE3C0965BD110016AC38 /* PdePreprocessor.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = PdePreprocessor.java; sourceTree = ""; }; - 33FFFE3D0965BD110016AC38 /* PreprocessorInfoChannel.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = PreprocessorInfoChannel.java; sourceTree = ""; }; - 33FFFE3E0965BD110016AC38 /* StdCLexer.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = StdCLexer.java; sourceTree = ""; }; - 33FFFE3F0965BD110016AC38 /* StdCParser.g */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = StdCParser.g; sourceTree = ""; }; - 33FFFE400965BD110016AC38 /* StdCParser.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = StdCParser.java; sourceTree = ""; }; - 33FFFE410965BD110016AC38 /* STDCTokenTypes.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = STDCTokenTypes.java; sourceTree = ""; }; - 33FFFE420965BD110016AC38 /* STDCTokenTypes.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = STDCTokenTypes.txt; sourceTree = ""; }; - 33FFFE430965BD110016AC38 /* TNode.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = TNode.java; sourceTree = ""; }; - 33FFFE440965BD110016AC38 /* TNodeFactory.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = TNodeFactory.java; sourceTree = ""; }; - 33FFFE450965BD110016AC38 /* WEmitter.g */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = WEmitter.g; sourceTree = ""; }; - 33FFFE460965BD110016AC38 /* WEmitter.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = WEmitter.java; sourceTree = ""; }; - 33FFFE470965BD110016AC38 /* WEmitterTokenTypes.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = WEmitterTokenTypes.java; sourceTree = ""; }; - 33FFFE480965BD110016AC38 /* WEmitterTokenTypes.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = WEmitterTokenTypes.txt; sourceTree = ""; }; - 33FFFE490965BD110016AC38 /* whitespace_test.pde */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = whitespace_test.pde; sourceTree = ""; }; - 33FFFE4A0965BD110016AC38 /* WLexer.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = WLexer.java; sourceTree = ""; }; - 33FFFE4B0965BD110016AC38 /* WLexerTokenTypes.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = WLexerTokenTypes.java; sourceTree = ""; }; - 33FFFE4C0965BD110016AC38 /* WLexerTokenTypes.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = WLexerTokenTypes.txt; sourceTree = ""; }; - 33FFFE4D0965BD110016AC38 /* WParser.g */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = WParser.g; sourceTree = ""; }; - 33FFFE4E0965BD110016AC38 /* WParser.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = WParser.java; sourceTree = ""; }; - 33FFFE4F0965BD110016AC38 /* WTokenTypes.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = WTokenTypes.java; sourceTree = ""; }; - 33FFFE500965BD110016AC38 /* WTokenTypes.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = WTokenTypes.txt; sourceTree = ""; }; - 33FFFE510965BD110016AC38 /* WTreeParser.g */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = WTreeParser.g; sourceTree = ""; }; - 33FFFE520965BD110016AC38 /* WTreeParser.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = WTreeParser.java; sourceTree = ""; }; - 33FFFE530965BD110016AC38 /* WTreeParserTokenTypes.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = WTreeParserTokenTypes.java; sourceTree = ""; }; - 33FFFE540965BD110016AC38 /* WTreeParserTokenTypes.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = WTreeParserTokenTypes.txt; sourceTree = ""; }; 33FFFE550965BD110016AC38 /* PresentMode.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = PresentMode.java; sourceTree = ""; }; 33FFFE560965BD110016AC38 /* Runner.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = Runner.java; sourceTree = ""; }; 33FFFE570965BD110016AC38 /* RunnerClassLoader.java */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.java; path = RunnerClassLoader.java; sourceTree = ""; }; @@ -581,6 +512,9 @@ 33FFFEBE0965BD110016AC38 /* make.sh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = make.sh; sourceTree = ""; }; 33FFFEBF0965BD110016AC38 /* mkdmg */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = mkdmg; sourceTree = ""; }; 33FFFEC00965BD110016AC38 /* run.sh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = run.sh; sourceTree = ""; }; + A33729610D224FA700E82412 /* librxtxSerial-intel.jnilib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; path = "librxtxSerial-intel.jnilib"; sourceTree = ""; }; + A33729620D224FA700E82412 /* librxtxSerial-ppc.jnilib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; path = "librxtxSerial-ppc.jnilib"; sourceTree = ""; }; + A33729630D224FA700E82412 /* librxtxSerial.jnilib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; path = librxtxSerial.jnilib; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -754,38 +688,7 @@ 33FFFE340965BD110016AC38 /* preproc */ = { isa = PBXGroup; children = ( - 33FFFE350965BD110016AC38 /* CSymbolTable.java */, - 33FFFE360965BD110016AC38 /* CToken.java */, - 33FFFE370965BD110016AC38 /* expandedWEmitter.g */, - 33FFFE380965BD110016AC38 /* expandedWParser.g */, - 33FFFE390965BD110016AC38 /* ExtendedCommonASTWithHiddenTokens.java */, - 33FFFE3A0965BD110016AC38 /* LineObject.java */, - 33FFFE3B0965BD110016AC38 /* Makefile */, 33FFFE3C0965BD110016AC38 /* PdePreprocessor.java */, - 33FFFE3D0965BD110016AC38 /* PreprocessorInfoChannel.java */, - 33FFFE3E0965BD110016AC38 /* StdCLexer.java */, - 33FFFE3F0965BD110016AC38 /* StdCParser.g */, - 33FFFE400965BD110016AC38 /* StdCParser.java */, - 33FFFE410965BD110016AC38 /* STDCTokenTypes.java */, - 33FFFE420965BD110016AC38 /* STDCTokenTypes.txt */, - 33FFFE430965BD110016AC38 /* TNode.java */, - 33FFFE440965BD110016AC38 /* TNodeFactory.java */, - 33FFFE450965BD110016AC38 /* WEmitter.g */, - 33FFFE460965BD110016AC38 /* WEmitter.java */, - 33FFFE470965BD110016AC38 /* WEmitterTokenTypes.java */, - 33FFFE480965BD110016AC38 /* WEmitterTokenTypes.txt */, - 33FFFE490965BD110016AC38 /* whitespace_test.pde */, - 33FFFE4A0965BD110016AC38 /* WLexer.java */, - 33FFFE4B0965BD110016AC38 /* WLexerTokenTypes.java */, - 33FFFE4C0965BD110016AC38 /* WLexerTokenTypes.txt */, - 33FFFE4D0965BD110016AC38 /* WParser.g */, - 33FFFE4E0965BD110016AC38 /* WParser.java */, - 33FFFE4F0965BD110016AC38 /* WTokenTypes.java */, - 33FFFE500965BD110016AC38 /* WTokenTypes.txt */, - 33FFFE510965BD110016AC38 /* WTreeParser.g */, - 33FFFE520965BD110016AC38 /* WTreeParser.java */, - 33FFFE530965BD110016AC38 /* WTreeParserTokenTypes.java */, - 33FFFE540965BD110016AC38 /* WTreeParserTokenTypes.txt */, ); path = preproc; sourceTree = ""; @@ -861,6 +764,9 @@ isa = PBXGroup; children = ( 335A28F20C8CCAF700D8A7F4 /* libquaqua.jnilib */, + A33729610D224FA700E82412 /* librxtxSerial-intel.jnilib */, + A33729620D224FA700E82412 /* librxtxSerial-ppc.jnilib */, + A33729630D224FA700E82412 /* librxtxSerial.jnilib */, 335A28F30C8CCAF700D8A7F4 /* quaqua.jar */, 33FFFEAE0965BD110016AC38 /* bootloader */, 33FFFEB20965BD110016AC38 /* drivers */, @@ -933,7 +839,22 @@ buildActionMask = 2147483647; files = ( 33CF03B209662CB700F2C9A9 /* arduino.icns in Resources */, - 339514EE097AEB5900193C89 /* STDCTokenTypes.txt in Resources */, + 33FF07240965C1E30016AC38 /* keywords.txt in Resources */, + 33FF07280965C1E30016AC38 /* preferences.txt in Resources */, + A3688DF40D284554003CBAA1 /* applet.html in Resources */, + 33FF071F0965C1E30016AC38 /* about.jpg in Resources */, + 33FF07220965C1E30016AC38 /* buttons.gif in Resources */, + 33FF07230965C1E30016AC38 /* icon.gif in Resources */, + 33FF07250965C1E30016AC38 /* loading.gif in Resources */, + 33FF072A0965C1E30016AC38 /* resize.gif in Resources */, + 33FF072C0965C1E30016AC38 /* tab-sel-left.gif in Resources */, + 33FF072D0965C1E30016AC38 /* tab-sel-menu.gif in Resources */, + 33FF072E0965C1E30016AC38 /* tab-sel-mid.gif in Resources */, + 33FF072F0965C1E30016AC38 /* tab-sel-right.gif in Resources */, + 33FF07300965C1E30016AC38 /* tab-unsel-left.gif in Resources */, + 33FF07310965C1E30016AC38 /* tab-unsel-menu.gif in Resources */, + 33FF07320965C1E30016AC38 /* tab-unsel-mid.gif in Resources */, + 33FF07330965C1E30016AC38 /* tab-unsel-right.gif in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -951,7 +872,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "unzip -od $BUILT_PRODUCTS_DIR/hardware dist/tools-universal.zip\ncp dist/librxtxSerial.jnilib $BUILT_PRODUCTS_DIR/librxtxSerial.jnilib"; + shellScript = "unzip -od $BUILT_PRODUCTS_DIR/hardware dist/tools-universal.zip\n"; }; 3318B11A0AD6CE9F00FE1A05 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -964,7 +885,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "unzip -od $BUILT_PRODUCTS_DIR/hardware dist/tools-universal.zip\ncp dist/librxtxSerial.jnilib $BUILT_PRODUCTS_DIR/librxtxSerial.jnilib"; + shellScript = "unzip -od $BUILT_PRODUCTS_DIR/hardware dist/tools-universal.zip\n"; }; 3318B1520AD6D1EB00FE1A05 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -977,7 +898,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cd $BUILT_PRODUCTS_DIR/../../\n\nREVISION=`head -1 ../../todo.txt | cut -c 1-4`\nSHORT_REVISION=`head -1 ../../todo.txt | cut -c 3-4`\nVERSIONED=`cat ../../app/Base.java | grep $REVISION`\n\nif [ -z \"$VERSIONED\" ]\nthen\n echo Fix the revision number in Base.java\n exit\nfi\n\nrm -rf arduino\nrm -rf arduino-*\n\nmv $BUILT_PRODUCTS_DIR arduino\n\nfind arduino -name \"*~\" -exec rm -f {} ';'\n# need to leave ds store stuff cuz one of those is important\n#find arduino -name \".DS_Store\" -exec rm -f {} ';'\nfind arduino -name \"._*\" -exec rm -f {} ';'\nfind arduino -name \"Thumbs.db\" -exec rm -f {} ';'\n\n# clean out the cvs entries\nfind arduino -name \"CVS\" -exec rm -rf {} ';' 2> /dev/null\nfind arduino -name \".cvsignore\" -exec rm -rf {} ';'\n\n# clean out the svn entries\nfind arduino -name \".svn\" -exec rm -rf {} ';' 2> /dev/null\n\n#mv arduino/Arduino.app/Contents/MacOS/Arduino \"arduino/Arduino.app/Contents/MacOS/Arduino $SHORT_REVISION\"\nmv arduino/Arduino.app \"arduino/Arduino $SHORT_REVISION.app\"\nmv arduino arduino-$REVISION\nzip -r arduino-$REVISION-mac-ppc.zip arduino-$REVISION\n"; + shellScript = "REVISION=`head -1 $SRCROOT/../../todo.txt | cut -c 1-4`\nSHORT_REVISION=`head -1 $SRCROOT/../../todo.txt | cut -c 3-4`\nVERSIONED=`cat $SRCROOT/../../app/Base.java | grep $REVISION`\n\nif [ -z \"$VERSIONED\" ]\nthen\n echo Fix the revision number in Base.java\n exit\nfi\n\ncd \"$SRCROOT\"\n\nrm -rf arduino\nrm -rf arduino-*\n\nmv $BUILT_PRODUCTS_DIR arduino\n\nfind arduino -name \"*~\" -exec rm -f {} ';'\n# need to leave ds store stuff cuz one of those is important\n#find arduino -name \".DS_Store\" -exec rm -f {} ';'\nfind arduino -name \"._*\" -exec rm -f {} ';'\nfind arduino -name \"Thumbs.db\" -exec rm -f {} ';'\n\n# clean out the cvs entries\nfind arduino -name \"CVS\" -exec rm -rf {} ';' 2> /dev/null\nfind arduino -name \".cvsignore\" -exec rm -rf {} ';'\n\n# clean out the svn entries\nfind arduino -name \".svn\" -exec rm -rf {} ';' 2> /dev/null\n\n#mv arduino/Arduino.app/Contents/MacOS/Arduino \"arduino/Arduino.app/Contents/MacOS/Arduino $SHORT_REVISION\"\nmv arduino/Arduino.app \"arduino/Arduino $SHORT_REVISION.app\"\nmv arduino arduino-$REVISION\nzip -r arduino-$REVISION-mac-ppc.zip arduino-$REVISION\n"; }; 3318B15E0AD6D1FC00FE1A05 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -1016,9 +937,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 33AF61760965C54B00B514A9 /* PreprocessorInfoChannel.java in Sources */, 33AF61770965C54B00B514A9 /* EditorListener.java in Sources */, - 33AF61780965C54B00B514A9 /* LineObject.java in Sources */, 33AF61790965C54B00B514A9 /* Serial.java in Sources */, 33AF617A0965C54B00B514A9 /* TextUtilities.java in Sources */, 33AF617B0965C54B00B514A9 /* EditorConsole.java in Sources */, @@ -1032,50 +951,34 @@ 33AF61830965C54B00B514A9 /* SyntaxStyle.java in Sources */, 33AF61840965C54B00B514A9 /* Uploader.java in Sources */, 33AF61850965C54B00B514A9 /* RunnerException.java in Sources */, - 33AF61860965C54B00B514A9 /* WParser.java in Sources */, 33AF61870965C54B00B514A9 /* TextAreaPainter.java in Sources */, 33AF61880965C54B00B514A9 /* Sketchbook.java in Sources */, 33AF61890965C54B00B514A9 /* EditorStatus.java in Sources */, - 33AF618A0965C54B00B514A9 /* WTokenTypes.java in Sources */, 33AF618B0965C54B00B514A9 /* TextAreaDefaults.java in Sources */, 33AF618C0965C54B00B514A9 /* PdePreprocessor.java in Sources */, - 33AF618D0965C54B00B514A9 /* CSymbolTable.java in Sources */, 33AF618E0965C54B00B514A9 /* SketchHistory.java in Sources */, 33AF618F0965C54B00B514A9 /* RunnerClassLoader.java in Sources */, 33AF61900965C54B00B514A9 /* MessageStream.java in Sources */, 33AF61910965C54B00B514A9 /* SyntaxUtilities.java in Sources */, 33AF61930965C54B00B514A9 /* PresentMode.java in Sources */, - 33AF61940965C54B00B514A9 /* STDCTokenTypes.java in Sources */, 33AF61950965C54B00B514A9 /* CTokenMarker.java in Sources */, - 33AF61960965C54B00B514A9 /* CToken.java in Sources */, - 33AF61970965C54B00B514A9 /* WTreeParserTokenTypes.java in Sources */, 33AF61990965C54B00B514A9 /* Runner.java in Sources */, - 33AF619A0965C54B00B514A9 /* TNode.java in Sources */, 33AF619B0965C54B00B514A9 /* KeywordMap.java in Sources */, - 33AF619C0965C54B00B514A9 /* ExtendedCommonASTWithHiddenTokens.java in Sources */, 33AF619D0965C54B00B514A9 /* Sketch.java in Sources */, - 33AF619E0965C54B00B514A9 /* WEmitterTokenTypes.java in Sources */, - 33AF619F0965C54B00B514A9 /* TNodeFactory.java in Sources */, 33AF61A00965C54B00B514A9 /* Target.java in Sources */, 33AF61A10965C54B00B514A9 /* UpdateCheck.java in Sources */, 33AF61A20965C54B00B514A9 /* InputHandler.java in Sources */, 33AF61A30965C54B00B514A9 /* MessageConsumer.java in Sources */, - 33AF61A40965C54B00B514A9 /* WLexer.java in Sources */, 33AF61A50965C54B00B514A9 /* Compiler.java in Sources */, 33AF61A60965C54B00B514A9 /* AutoFormat.java in Sources */, - 33AF61A70965C54B00B514A9 /* StdCLexer.java in Sources */, - 33AF61A80965C54B00B514A9 /* StdCParser.java in Sources */, 33AF61A90965C54B00B514A9 /* PdeKeywords.java in Sources */, 33AF61AA0965C54B00B514A9 /* Editor.java in Sources */, - 33AF61AB0965C54B00B514A9 /* WEmitter.java in Sources */, 33AF61AC0965C54B00B514A9 /* SwingWorker.java in Sources */, 33AF61AD0965C54B00B514A9 /* DefaultInputHandler.java in Sources */, 33AF61AE0965C54B00B514A9 /* SyntaxDocument.java in Sources */, - 33AF61AF0965C54B00B514A9 /* WLexerTokenTypes.java in Sources */, 33AF61B00965C54B00B514A9 /* Token.java in Sources */, 33AF61B10965C54B00B514A9 /* Preferences.java in Sources */, 33AF61B20965C54B00B514A9 /* PdeTextAreaDefaults.java in Sources */, - 33AF61B30965C54B00B514A9 /* WTreeParser.java in Sources */, 33AF61B40965C54B00B514A9 /* JEditTextArea.java in Sources */, 33AF61B50965C54B00B514A9 /* Base.java in Sources */, 332D4DB609CF147F00BF81F6 /* Sizer.java in Sources */, diff --git a/todo.txt b/todo.txt index 29d334402..613d55bfc 100644 --- a/todo.txt +++ b/todo.txt @@ -1 +1 @@ -0010 arduino +0011 arduino