Changeset 924:68c75dc906c8 in livinglogic.java.ul4

Show
Ignore:
Timestamp:
12/29/13 11:36:32 (5 years ago)
Author:
Walter Doerwald <walter@…>
Parents:
922:c1f97de72025 (diff), 923:bb9f065e3037 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Branch:
default
Tags:
tip
Message:

Automated merge with ssh://bitbucket.org/doerwalter/livinglogic.java.ul4

Location:
src/main
Files:
4 removed
4 modified

Legend:

Unmodified
Added
Removed
  • src/main/antlr3/com/livinglogic/ul4/UL4.g

    r922 r924  
    507507    ; 
    508508 
     509/* Binary shift */ 
     510expr_bitshift returns [AST node] 
     511    @init 
     512    { 
     513        boolean left = false; 
     514    } 
     515    : 
     516        e1=expr_add { $node = $e1.node; } 
     517        ( 
     518            ( 
     519                '<<' { left = true; } 
     520            | 
     521                '>>' { left = false; } 
     522            ) 
     523            e2=expr_add { $node = left ? ShiftLeftAST.make(location, $node.getStart(), $e2.node.getEnd(), $node, $e2.node) : ShiftRightAST.make(location, $node.getStart(), $e2.node.getEnd(), $node, $e2.node); } 
     524        )* 
     525    ; 
     526 
    509527/* Comparisons */ 
    510528expr_cmp returns [AST node] 
     
    514532    } 
    515533    : 
    516         e1=expr_add { $node = $e1.node; } 
     534        e1=expr_bitshift { $node = $e1.node; } 
    517535        ( 
    518536            ( 
     
    529547                '>=' { opcode = 5; } 
    530548            ) 
    531             e2=expr_add { switch (opcode) { case 0: $node = EQAST.make(location, $node.getStart(), $e2.node.getEnd(), $node, $e2.node); break; case 1: $node = NEAST.make(location, $node.getStart(), $e2.node.getEnd(), $node, $e2.node); break; case 2: $node = LTAST.make(location, $node.getStart(), $e2.node.getEnd(), $node, $e2.node); break; case 3: $node = LEAST.make(location, $node.getStart(), $e2.node.getEnd(), $node, $e2.node); break; case 4: $node = GTAST.make(location, $node.getStart(), $e2.node.getEnd(), $node, $e2.node); break; case 5: $node = GEAST.make(location, $node.getStart(), $e2.node.getEnd(), $node, $e2.node); break; } } 
     549            e2=expr_bitshift { switch (opcode) { case 0: $node = EQAST.make(location, $node.getStart(), $e2.node.getEnd(), $node, $e2.node); break; case 1: $node = NEAST.make(location, $node.getStart(), $e2.node.getEnd(), $node, $e2.node); break; case 2: $node = LTAST.make(location, $node.getStart(), $e2.node.getEnd(), $node, $e2.node); break; case 3: $node = LEAST.make(location, $node.getStart(), $e2.node.getEnd(), $node, $e2.node); break; case 4: $node = GTAST.make(location, $node.getStart(), $e2.node.getEnd(), $node, $e2.node); break; case 5: $node = GEAST.make(location, $node.getStart(), $e2.node.getEnd(), $node, $e2.node); break; } } 
    532550        )* 
    533551    ; 
     
    623641    | n=expr_subscript '/=' e=expr_if EOF { if ($n.node instanceof LValue) $node = new TrueDivVarAST(location, location.getStartCode(), $e.node.getEnd(), (LValue)$n.node, $e.node); else throw new RuntimeException("lvalue required"); } 
    624642    | n=expr_subscript '%=' e=expr_if EOF { if ($n.node instanceof LValue) $node = new ModVarAST(location, location.getStartCode(), $e.node.getEnd(), (LValue)$n.node, $e.node); else throw new RuntimeException("lvalue required"); } 
     643    | n=expr_subscript '<<=' e=expr_if EOF { if ($n.node instanceof LValue) $node = new ShiftLeftVarAST(location, location.getStartCode(), $e.node.getEnd(), (LValue)$n.node, $e.node); else throw new RuntimeException("lvalue required"); } 
     644    | n=expr_subscript '>>=' e=expr_if EOF { if ($n.node instanceof LValue) $node = new ShiftRightVarAST(location, location.getStartCode(), $e.node.getEnd(), (LValue)$n.node, $e.node); else throw new RuntimeException("lvalue required"); } 
    625645    | e=expression EOF { $node = $e.node; } 
    626646    ; 
  • src/main/antlr3/com/livinglogic/ul4/UL4.g

    r923 r924  
    605605            e2=expr_or 
    606606            'else' 
    607             e3=expr_or { $node = IfExpressionAST.make(location, $e1.node.getStart(), $e3.node.getEnd(), $e1.node, $e2.node, $e3.node); } 
     607            e3=expr_or { $node = IfAST.make(location, $e1.node.getStart(), $e3.node.getEnd(), $e1.node, $e2.node, $e3.node); } 
    608608        )? 
    609609    ; 
     
    622622/* Additional rules for "for" tag */ 
    623623 
    624 for_ returns [ForAST node] 
     624for_ returns [ForBlockAST node] 
    625625    : 
    626626        n=nestedlvalue 
    627627        'in' 
    628         e=expr_if { $node = new ForAST(location, location.getStartCode(), $e.node.getEnd(), $n.lvalue, $e.node); } 
     628        e=expr_if { $node = new ForBlockAST(location, location.getStartCode(), $e.node.getEnd(), $n.lvalue, $e.node); } 
    629629        EOF 
    630630    ; 
  • src/main/java/com/livinglogic/ul4/InterpretedTemplate.java

    r922 r924  
    732732        Utils.register("de.livinglogic.ul4.return", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ReturnAST(null, -1, -1, null); }}); 
    733733        Utils.register("de.livinglogic.ul4.item", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ItemAST(null, -1, -1, null, null); }}); 
     734        Utils.register("de.livinglogic.ul4.shiftleft", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ShiftLeftAST(null, -1, -1, null, null); }}); 
     735        Utils.register("de.livinglogic.ul4.shiftright", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ShiftRightAST(null, -1, -1, null, null); }}); 
    734736        Utils.register("de.livinglogic.ul4.eq", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.EQAST(null, -1, -1, null, null); }}); 
    735737        Utils.register("de.livinglogic.ul4.ne", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.NEAST(null, -1, -1, null, null); }}); 
     
    755757        Utils.register("de.livinglogic.ul4.truedivvar", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.TrueDivVarAST(null, -1, -1, null, null); }}); 
    756758        Utils.register("de.livinglogic.ul4.modvar", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ModVarAST(null, -1, -1, null, null); }}); 
     759        Utils.register("de.livinglogic.ul4.shiftleftvar", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ShiftLeftVarAST(null, -1, -1, null, null); }}); 
     760        Utils.register("de.livinglogic.ul4.shiftrightvar", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ShiftRightVarAST(null, -1, -1, null, null); }}); 
    757761        Utils.register("de.livinglogic.ul4.call", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.CallAST(null, -1, -1, null); }}); 
    758762        Utils.register("de.livinglogic.ul4.template", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.InterpretedTemplate(null, null, null, false, null, null); }}); 
  • src/main/java/com/livinglogic/ul4/InterpretedTemplate.java

    r923 r924  
    3939     * The version number used in the UL4ON dump of the template. 
    4040     */ 
    41     public static final String VERSION = "26"; 
     41    public static final String VERSION = "27"; 
    4242 
    4343    /** 
     
    156156                { 
    157157                    UL4Parser parser = getParser(location); 
    158                     ConditionalBlocks node = new ConditionalBlocks(location, location.getStartCode(), location.getEndCode(), new IfAST(location, location.getStartCode(), location.getEndCode(), parser.expression())); 
     158                    ConditionalBlocks node = new ConditionalBlocks(location, location.getStartCode(), location.getEndCode(), new IfBlockAST(location, location.getStartCode(), location.getEndCode(), parser.expression())); 
    159159                    innerBlock.append(node); 
    160160                    stack.push(node); 
     
    165165                    { 
    166166                        UL4Parser parser = getParser(location); 
    167                         ((ConditionalBlocks)innerBlock).startNewBlock(new ElIfAST(location, location.getStartCode(), location.getEndCode(), parser.expression())); 
     167                        ((ConditionalBlocks)innerBlock).startNewBlock(new ElIfBlockAST(location, location.getStartCode(), location.getEndCode(), parser.expression())); 
    168168                    } 
    169169                    else 
     
    174174                    if (innerBlock instanceof ConditionalBlocks) 
    175175                    { 
    176                         ((ConditionalBlocks)innerBlock).startNewBlock(new ElseAST(location, location.getStartCode(), location.getEndCode())); 
     176                        ((ConditionalBlocks)innerBlock).startNewBlock(new ElseBlockAST(location, location.getStartCode(), location.getEndCode())); 
    177177                    } 
    178178                    else 
     
    716716        Utils.register("de.livinglogic.ul4.genexpr", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.GeneratorExpressionAST(null, -1, -1, null, null, null, null); }}); 
    717717        Utils.register("de.livinglogic.ul4.var", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.VarAST(null, -1, -1, null); }}); 
    718         Utils.register("de.livinglogic.ul4.ieie", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ConditionalBlocks(null, -1, -1); }}); 
    719         Utils.register("de.livinglogic.ul4.if", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.IfAST(null, -1, -1, null); }}); 
    720         Utils.register("de.livinglogic.ul4.elif", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ElIfAST(null, -1, -1, null); }}); 
    721         Utils.register("de.livinglogic.ul4.else", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ElseAST(null, -1, -1); }}); 
    722         Utils.register("de.livinglogic.ul4.for", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ForAST(null, -1, -1, null, null); }}); 
     718        Utils.register("de.livinglogic.ul4.condblock", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ConditionalBlocks(null, -1, -1); }}); 
     719        Utils.register("de.livinglogic.ul4.ifblock", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.IfBlockAST(null, -1, -1, null); }}); 
     720        Utils.register("de.livinglogic.ul4.elifblock", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ElIfBlockAST(null, -1, -1, null); }}); 
     721        Utils.register("de.livinglogic.ul4.elseblock", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ElseBlockAST(null, -1, -1); }}); 
     722        Utils.register("de.livinglogic.ul4.forblock", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ForBlockAST(null, -1, -1, null, null); }}); 
    723723        Utils.register("de.livinglogic.ul4.break", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.BreakAST(null, -1, -1); }}); 
    724724        Utils.register("de.livinglogic.ul4.continue", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.ContinueAST(null, -1, -1); }}); 
     
    726726        Utils.register("de.livinglogic.ul4.slice", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.SliceAST(null, -1, -1, null, null, null); }}); 
    727727        Utils.register("de.livinglogic.ul4.not", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.NotAST(null, -1, -1, null); }}); 
    728         Utils.register("de.livinglogic.ul4.ifexpr", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.IfExpressionAST(null, -1, -1, null, null, null); }}); 
     728        Utils.register("de.livinglogic.ul4.if", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.IfAST(null, -1, -1, null, null, null); }}); 
    729729        Utils.register("de.livinglogic.ul4.neg", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.NegAST(null, -1, -1, null); }}); 
    730730        Utils.register("de.livinglogic.ul4.print", new ObjectFactory(){ public UL4ONSerializable create() { return new com.livinglogic.ul4.PrintAST(null, -1, -1, null); }});