Changeset 2360


Ignore:
Timestamp:
Sep 5, 2012, 11:10:57 AM (6 years ago)
Author:
bhull
Message:

Added debugging demo and bug fixes for some strategies.

Location:
proto/RE
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • proto/RE/src/codeGenerator/CharacterClassVariableGenerator.java

    r2331 r2360  
    66                super();
    77                position=0;
    8                 prefix ="cc";
     8                prefix ="lex.cc";
    99        }
    1010        public CharacterClassVariableGenerator(String prefix) {
     
    1313                this.prefix = prefix;
    1414        }
    15         private String prefix;
    16         private int position;
     15        public String prefix;
     16        public int position;
    1717        public String getNextCharacterClassVariable()
    1818        {
  • proto/RE/src/codeGenerator/CodeGenerator.java

    r2331 r2360  
    4848                        if (repetitionType.equals("*")) {
    4949                                Output add = oG.makeAdd(oG.makeVariable(nodeState.getCursorVariable()), oG.makeVariable(characterClassVariables.get(childState.getCharacterClassRepresentationString())));
    50                                 Output xor = oG.makeXOr(add, oG.makeVariable(characterClassVariables.get(childState.getCharacterClassRepresentationString())));
    51                                 Output or = oG.makeOr(xor, oG.makeVariable(nodeState.getCursorVariable()));
     50                                Output andNot = oG.makeAnd(add, oG.makeNot(oG.makeVariable(characterClassVariables.get(childState.getCharacterClassRepresentationString()))));
     51                                Output or = oG.makeOr(andNot, oG.makeVariable(nodeState.getCursorVariable()));
    5252                                out = oG.makeAssignment(oG.makeVariable(nodeState.getCursorVariable()), or);
    5353                        }
     
    5656                                out = oG.combineStatements(out, oG.makeAssignment(oG.makeVariable(nodeState.getCursorVariable()), oG.makeVariable(childState.getCursorVariable())));
    5757                                Output add = oG.makeAdd(oG.makeVariable(nodeState.getCursorVariable()), oG.makeVariable(characterClassVariables.get(childState.getCharacterClassRepresentationString())));
    58                                 Output xor = oG.makeXOr(add, oG.makeVariable(characterClassVariables.get(childState.getCharacterClassRepresentationString())));
    59                                 Output or = oG.makeOr(xor, oG.makeVariable(nodeState.getCursorVariable()));
     58                                Output andNot = oG.makeAnd(add, oG.makeNot(oG.makeVariable(characterClassVariables.get(childState.getCharacterClassRepresentationString()))));
     59                                Output or = oG.makeOr(andNot, oG.makeVariable(nodeState.getCursorVariable()));
    6060                                out = oG.combineStatements(out,oG.makeAssignment(oG.makeVariable(nodeState.getCursorVariable()), or));
    6161                        }
  • proto/RE/src/codeGenerator/CursorGenerator.java

    r2310 r2360  
    55                super();
    66                position=0;
     7                prefix = "m";
    78        }
    8         private int position;
     9        public int position;
     10        public String prefix;
    911        public String getNextCursorVariable()
    1012        {
    11                 String out = "m"+this.position;
     13                String out = prefix+this.position;
    1214                position+=1;
    1315                return out;
  • proto/RE/src/codeGenerator/PythonGenerator.java

    r2331 r2360  
    66        public Output makeAssignment(Output lhs, Output rhs) {
    77
    8                 return new PythonOutput(lhs + " = " + rhs);
     8                return indentBlock(new PythonOutput(lhs + " = " + rhs));
    99        }
    1010
     
    3939        @Override
    4040        public Output makeWhile(Output condition, Output body) {
    41                 return new PythonOutput("while "+condition+":"+lineBreak+indentBlock(body));
     41                return indentBlock(new PythonOutput("while "+condition+":"+lineBreak+indentBlock(body)));
    4242        }
    4343
  • proto/RE/src/codeGenerator/Visitor.java

    r2331 r2360  
    1717
    1818public class Visitor extends Default<ASTNode> {
    19         private CursorGenerator cursorGenerator;
    20         private CharacterClassVariableGenerator characterClassVariableGenerator;
     19        public CursorGenerator cursorGenerator;
     20        public CharacterClassVariableGenerator characterClassVariableGenerator;
    2121        private Map<ASTNode, NodeState> nodeStates;
    2222       
Note: See TracChangeset for help on using the changeset viewer.