From 2b25736cc80f709402d6ec0d5b8122b17125c21a Mon Sep 17 00:00:00 2001 From: romanman Date: Wed, 28 May 2014 09:11:24 +0300 Subject: [PATCH] [asm asm] block fixing bugs and setting color style --- .../java/org/ethereum/gui/SerpentEditor.java | 36 +- .../org/ethereum/gui/SerpentTokenMaker.java | 10 +- .../main/java/org/ethereum/serpent/Serpent.g4 | 3 +- .../ethereum/serpent/SerpentBaseListener.java | 39 +- .../ethereum/serpent/SerpentBaseVisitor.java | 12 +- .../org/ethereum/serpent/SerpentCompiler.java | 20 +- .../org/ethereum/serpent/SerpentListener.java | 33 +- .../org/ethereum/serpent/SerpentParser.java | 697 ++++++++++-------- .../serpent/SerpentToAssemblyCompiler.java | 7 +- .../org/ethereum/serpent/SerpentVisitor.java | 21 +- 10 files changed, 504 insertions(+), 374 deletions(-) diff --git a/ethereumj-core/src/main/java/org/ethereum/gui/SerpentEditor.java b/ethereumj-core/src/main/java/org/ethereum/gui/SerpentEditor.java index e74ad176..8861ac03 100644 --- a/ethereumj-core/src/main/java/org/ethereum/gui/SerpentEditor.java +++ b/ethereumj-core/src/main/java/org/ethereum/gui/SerpentEditor.java @@ -2,9 +2,7 @@ package org.ethereum.gui; import org.abego.treelayout.internal.util.Contract; import org.ethereum.serpent.SerpentCompiler; -import org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory; -import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; -import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; +import org.fife.ui.rsyntaxtextarea.*; import org.fife.ui.rtextarea.RTextScrollPane; import javax.swing.*; @@ -46,7 +44,7 @@ public class SerpentEditor extends JFrame { "return(0)\n"; - + private final RSyntaxTextArea codeArea; private static final long serialVersionUID = 1L; public SerpentEditor() { @@ -63,11 +61,12 @@ public class SerpentEditor extends JFrame { AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory)TokenMakerFactory.getDefaultInstance(); atmf.putMapping("text/serpent", "org.ethereum.gui.SerpentTokenMaker"); - final RSyntaxTextArea codeArea = new RSyntaxTextArea(32, 80); + codeArea = new RSyntaxTextArea(32, 80); codeArea.setSyntaxEditingStyle("text/serpent"); codeArea.setCodeFoldingEnabled(true); codeArea.setAntiAliasingEnabled(true); codeArea.setText(codeSample2); + changeStyleProgrammatically(); RTextScrollPane sp = new RTextScrollPane(codeArea); @@ -184,6 +183,33 @@ public class SerpentEditor extends JFrame { } + private void changeStyleProgrammatically() { + + // Set the font for all token types. + + // Change a few things here and there. + SyntaxScheme scheme = codeArea.getSyntaxScheme(); + +// scheme.getStyle(Token.RESERVED_WORD).background = Color.white; +// scheme.getStyle(Token.RESERVED_WORD).foreground = Color.BLUE; + + scheme.getStyle(Token.IDENTIFIER).foreground = Color.black; + + + scheme.getStyle(Token.RESERVED_WORD_2).background = Color.white; + scheme.getStyle(Token.RESERVED_WORD_2).foreground = Color.MAGENTA.darker().darker(); + + +// scheme.getStyle(Token.LITERAL_STRING_DOUBLE_QUOTE).underline = true; +// scheme.getStyle(Token.LITERAL_NUMBER_HEXADECIMAL).underline = true; +// scheme.getStyle(Token.LITERAL_NUMBER_HEXADECIMAL).background = Color.pink; + +// scheme.getStyle(Token.COMMENT_EOL).font = new Font("Georgia", Font.ITALIC, 10); + + codeArea.revalidate(); + } + + public static void main(String[] args) { // Start all Swing applications on the EDT. SwingUtilities.invokeLater(new Runnable() { diff --git a/ethereumj-core/src/main/java/org/ethereum/gui/SerpentTokenMaker.java b/ethereumj-core/src/main/java/org/ethereum/gui/SerpentTokenMaker.java index f77c8f0b..c0e2ac46 100644 --- a/ethereumj-core/src/main/java/org/ethereum/gui/SerpentTokenMaker.java +++ b/ethereumj-core/src/main/java/org/ethereum/gui/SerpentTokenMaker.java @@ -2,6 +2,7 @@ package org.ethereum.gui; import javax.swing.text.Segment; +import org.ethereum.vm.OpCode; import org.fife.ui.rsyntaxtextarea.*; @@ -98,7 +99,7 @@ public class SerpentTokenMaker extends AbstractTokenMaker { @Override public TokenMap getWordsToHighlight() { - TokenMap tokenMap = new TokenMap(true); // Ignore case. + TokenMap tokenMap = new TokenMap(false); // Ignore case. int reservedWord = Token.RESERVED_WORD; tokenMap.put("set", reservedWord); @@ -135,6 +136,13 @@ public class SerpentTokenMaker extends AbstractTokenMaker { tokenMap.put("block", function); tokenMap.put("tx", function); + // ALL the assembly tokens + int reservedWord2 = Token.RESERVED_WORD_2; + for (OpCode value : OpCode.values()){ + tokenMap.put(value.name(), reservedWord2); + tokenMap.put("[asm", reservedWord2); + tokenMap.put("asm]", reservedWord2); + } return tokenMap; diff --git a/ethereumj-core/src/main/java/org/ethereum/serpent/Serpent.g4 b/ethereumj-core/src/main/java/org/ethereum/serpent/Serpent.g4 index 92393637..2192ddb9 100644 --- a/ethereumj-core/src/main/java/org/ethereum/serpent/Serpent.g4 +++ b/ethereumj-core/src/main/java/org/ethereum/serpent/Serpent.g4 @@ -31,7 +31,8 @@ parse: block EOF block: ( asm | assign | special_func | if_elif_else_stmt | while_stmt | ret_func | msg_func)* ; -asm: '[asm' (ASM_SYMBOLS | INT)* 'asm]' NL; +asm: '[asm' asm_symbol 'asm]' NL; +asm_symbol: (ASM_SYMBOLS | INT)* ; if_elif_else_stmt: 'if' condition ':' INDENT block DEDENT ('elif' condition ':' INDENT block DEDENT)* diff --git a/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentBaseListener.java b/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentBaseListener.java index 2d344c6a..7c81dad2 100644 --- a/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentBaseListener.java +++ b/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentBaseListener.java @@ -90,6 +90,19 @@ public class SerpentBaseListener implements SerpentListener { */ @Override public void exitBlock(@NotNull SerpentParser.BlockContext ctx) { } + /** + * {@inheritDoc} + *

+ * The default implementation does nothing. + */ + @Override public void enterAsm_symbol(@NotNull SerpentParser.Asm_symbolContext ctx) { } + /** + * {@inheritDoc} + *

+ * The default implementation does nothing. + */ + @Override public void exitAsm_symbol(@NotNull SerpentParser.Asm_symbolContext ctx) { } + /** * {@inheritDoc} *

@@ -220,19 +233,6 @@ public class SerpentBaseListener implements SerpentListener { */ @Override public void exitBlock_gaslimit(@NotNull SerpentParser.Block_gaslimitContext ctx) { } - /** - * {@inheritDoc} - *

- * The default implementation does nothing. - */ - @Override public void enterMsg_func(@NotNull SerpentParser.Msg_funcContext ctx) { } - /** - * {@inheritDoc} - *

- * The default implementation does nothing. - */ - @Override public void exitMsg_func(@NotNull SerpentParser.Msg_funcContext ctx) { } - /** * {@inheritDoc} *

@@ -246,6 +246,19 @@ public class SerpentBaseListener implements SerpentListener { */ @Override public void exitRel_exp(@NotNull SerpentParser.Rel_expContext ctx) { } + /** + * {@inheritDoc} + *

+ * The default implementation does nothing. + */ + @Override public void enterMsg_func(@NotNull SerpentParser.Msg_funcContext ctx) { } + /** + * {@inheritDoc} + *

+ * The default implementation does nothing. + */ + @Override public void exitMsg_func(@NotNull SerpentParser.Msg_funcContext ctx) { } + /** * {@inheritDoc} *

diff --git a/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentBaseVisitor.java b/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentBaseVisitor.java index b0cd0105..c6678c58 100644 --- a/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentBaseVisitor.java +++ b/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentBaseVisitor.java @@ -60,6 +60,14 @@ public class SerpentBaseVisitor extends AbstractParseTreeVisitor implement */ @Override public T visitBlock(@NotNull SerpentParser.BlockContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + *

+ * The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}. + */ + @Override public T visitAsm_symbol(@NotNull SerpentParser.Asm_symbolContext ctx) { return visitChildren(ctx); } + /** * {@inheritDoc} *

@@ -146,7 +154,7 @@ public class SerpentBaseVisitor extends AbstractParseTreeVisitor implement * The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}. */ - @Override public T visitMsg_func(@NotNull SerpentParser.Msg_funcContext ctx) { return visitChildren(ctx); } + @Override public T visitRel_exp(@NotNull SerpentParser.Rel_expContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} @@ -154,7 +162,7 @@ public class SerpentBaseVisitor extends AbstractParseTreeVisitor implement * The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}. */ - @Override public T visitRel_exp(@NotNull SerpentParser.Rel_expContext ctx) { return visitChildren(ctx); } + @Override public T visitMsg_func(@NotNull SerpentParser.Msg_funcContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} diff --git a/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentCompiler.java b/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentCompiler.java index 27942972..9265becd 100644 --- a/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentCompiler.java +++ b/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentCompiler.java @@ -44,7 +44,19 @@ public class SerpentCompiler { List lexaList = new ArrayList(); Collections.addAll(lexaList, lexaArr); + // temporary remove all push inserted + // by [asm asm] block + for (int i = 0; i < lexaList.size(); ++i){ + + String lexa = lexaList.get(i); + if (lexa.length() >= 4 && lexa.substring(0,4).equals("PUSH")){ + + lexaList.remove(i); + } + } + // Encode push_n numbers + boolean skiping = false; for (int i = 0; i < lexaList.size(); ++i){ String lexa = lexaList.get(i); @@ -53,16 +65,16 @@ public class SerpentCompiler { lexa.contains("REF_") || lexa.contains("LABEL_")) continue; - int bytesNum = ByteUtil.numBytes( lexa ); + int bytesNum = ByteUtil.numBytes(lexa); String num = lexaList.remove(i); BigInteger bNum = new BigInteger(num); byte[] bytes = BigIntegers.asUnsignedByteArray(bNum); - if (bytes.length == 0)bytes = new byte[]{0}; + if (bytes.length == 0) bytes = new byte[]{0}; - for (int j = bytes.length; j > 0 ; --j){ + for (int j = bytes.length; j > 0; --j) { - lexaList.add(i, (bytes[j-1] & 0xFF) +""); + lexaList.add(i, (bytes[j - 1] & 0xFF) + ""); } lexaList.add(i, "PUSH" + bytesNum); diff --git a/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentListener.java b/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentListener.java index ebe0d65b..e2c590db 100644 --- a/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentListener.java +++ b/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentListener.java @@ -74,6 +74,17 @@ public interface SerpentListener extends ParseTreeListener { */ void exitBlock(@NotNull SerpentParser.BlockContext ctx); + /** + * Enter a parse tree produced by {@link SerpentParser#asm_symbol}. + * @param ctx the parse tree + */ + void enterAsm_symbol(@NotNull SerpentParser.Asm_symbolContext ctx); + /** + * Exit a parse tree produced by {@link SerpentParser#asm_symbol}. + * @param ctx the parse tree + */ + void exitAsm_symbol(@NotNull SerpentParser.Asm_symbolContext ctx); + /** * Enter a parse tree produced by {@link SerpentParser#tx_gas}. * @param ctx the parse tree @@ -184,17 +195,6 @@ public interface SerpentListener extends ParseTreeListener { */ void exitBlock_gaslimit(@NotNull SerpentParser.Block_gaslimitContext ctx); - /** - * Enter a parse tree produced by {@link SerpentParser#msg_func}. - * @param ctx the parse tree - */ - void enterMsg_func(@NotNull SerpentParser.Msg_funcContext ctx); - /** - * Exit a parse tree produced by {@link SerpentParser#msg_func}. - * @param ctx the parse tree - */ - void exitMsg_func(@NotNull SerpentParser.Msg_funcContext ctx); - /** * Enter a parse tree produced by {@link SerpentParser#rel_exp}. * @param ctx the parse tree @@ -206,6 +206,17 @@ public interface SerpentListener extends ParseTreeListener { */ void exitRel_exp(@NotNull SerpentParser.Rel_expContext ctx); + /** + * Enter a parse tree produced by {@link SerpentParser#msg_func}. + * @param ctx the parse tree + */ + void enterMsg_func(@NotNull SerpentParser.Msg_funcContext ctx); + /** + * Exit a parse tree produced by {@link SerpentParser#msg_func}. + * @param ctx the parse tree + */ + void exitMsg_func(@NotNull SerpentParser.Msg_funcContext ctx); + /** * Enter a parse tree produced by {@link SerpentParser#parse}. * @param ctx the parse tree diff --git a/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentParser.java b/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentParser.java index d4761220..271eeb51 100644 --- a/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentParser.java +++ b/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentParser.java @@ -33,24 +33,24 @@ public class SerpentParser extends Parser { "HEX_NUMBER", "INDENT", "DEDENT" }; public static final int - RULE_parse = 0, RULE_block = 1, RULE_asm = 2, RULE_if_elif_else_stmt = 3, - RULE_while_stmt = 4, RULE_special_func = 5, RULE_msg_datasize = 6, RULE_msg_sender = 7, - RULE_msg_value = 8, RULE_tx_gasprice = 9, RULE_tx_origin = 10, RULE_tx_gas = 11, - RULE_contract_balance = 12, RULE_block_prevhash = 13, RULE_block_coinbase = 14, - RULE_block_timestamp = 15, RULE_block_number = 16, RULE_block_difficulty = 17, - RULE_block_gaslimit = 18, RULE_msg_func = 19, RULE_assign = 20, RULE_mul_expr = 21, - RULE_add_expr = 22, RULE_rel_exp = 23, RULE_eq_exp = 24, RULE_and_exp = 25, - RULE_ex_or_exp = 26, RULE_in_or_exp = 27, RULE_log_and_exp = 28, RULE_log_or_exp = 29, - RULE_expression = 30, RULE_condition = 31, RULE_int_val = 32, RULE_hex_num = 33, - RULE_ret_func = 34, RULE_get_var = 35; + RULE_parse = 0, RULE_block = 1, RULE_asm = 2, RULE_asm_symbol = 3, RULE_if_elif_else_stmt = 4, + RULE_while_stmt = 5, RULE_special_func = 6, RULE_msg_datasize = 7, RULE_msg_sender = 8, + RULE_msg_value = 9, RULE_tx_gasprice = 10, RULE_tx_origin = 11, RULE_tx_gas = 12, + RULE_contract_balance = 13, RULE_block_prevhash = 14, RULE_block_coinbase = 15, + RULE_block_timestamp = 16, RULE_block_number = 17, RULE_block_difficulty = 18, + RULE_block_gaslimit = 19, RULE_msg_func = 20, RULE_assign = 21, RULE_mul_expr = 22, + RULE_add_expr = 23, RULE_rel_exp = 24, RULE_eq_exp = 25, RULE_and_exp = 26, + RULE_ex_or_exp = 27, RULE_in_or_exp = 28, RULE_log_and_exp = 29, RULE_log_or_exp = 30, + RULE_expression = 31, RULE_condition = 32, RULE_int_val = 33, RULE_hex_num = 34, + RULE_ret_func = 35, RULE_get_var = 36; public static final String[] ruleNames = { - "parse", "block", "asm", "if_elif_else_stmt", "while_stmt", "special_func", - "msg_datasize", "msg_sender", "msg_value", "tx_gasprice", "tx_origin", - "tx_gas", "contract_balance", "block_prevhash", "block_coinbase", "block_timestamp", - "block_number", "block_difficulty", "block_gaslimit", "msg_func", "assign", - "mul_expr", "add_expr", "rel_exp", "eq_exp", "and_exp", "ex_or_exp", "in_or_exp", - "log_and_exp", "log_or_exp", "expression", "condition", "int_val", "hex_num", - "ret_func", "get_var" + "parse", "block", "asm", "asm_symbol", "if_elif_else_stmt", "while_stmt", + "special_func", "msg_datasize", "msg_sender", "msg_value", "tx_gasprice", + "tx_origin", "tx_gas", "contract_balance", "block_prevhash", "block_coinbase", + "block_timestamp", "block_number", "block_difficulty", "block_gaslimit", + "msg_func", "assign", "mul_expr", "add_expr", "rel_exp", "eq_exp", "and_exp", + "ex_or_exp", "in_or_exp", "log_and_exp", "log_or_exp", "expression", "condition", + "int_val", "hex_num", "ret_func", "get_var" }; @Override @@ -99,8 +99,8 @@ public class SerpentParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(72); block(); - setState(73); match(EOF); + setState(74); block(); + setState(75); match(EOF); } } catch (RecognitionException re) { @@ -183,21 +183,21 @@ public class SerpentParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(84); + setState(86); _errHandler.sync(this); _la = _input.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << 1) | (1L << 2) | (1L << 4) | (1L << 7) | (1L << 8) | (1L << 9) | (1L << 10) | (1L << 13) | (1L << 15) | (1L << 16) | (1L << 17) | (1L << 18) | (1L << 19) | (1L << 20) | (1L << 22) | (1L << 23) | (1L << 24) | (1L << 25) | (1L << VAR))) != 0)) { { - setState(82); + setState(84); switch (_input.LA(1)) { case 18: { - setState(75); asm(); + setState(77); asm(); } break; case VAR: { - setState(76); assign(); + setState(78); assign(); } break; case 1: @@ -214,34 +214,34 @@ public class SerpentParser extends Parser { case 24: case 25: { - setState(77); special_func(); + setState(79); special_func(); } break; case 13: { - setState(78); if_elif_else_stmt(); + setState(80); if_elif_else_stmt(); } break; case 8: { - setState(79); while_stmt(); + setState(81); while_stmt(); } break; case 15: { - setState(80); ret_func(); + setState(82); ret_func(); } break; case 10: { - setState(81); msg_func(); + setState(83); msg_func(); } break; default: throw new NoViableAltException(this); } } - setState(86); + setState(88); _errHandler.sync(this); _la = _input.LA(1); } @@ -260,13 +260,8 @@ public class SerpentParser extends Parser { public static class AsmContext extends ParserRuleContext { public TerminalNode NL() { return getToken(SerpentParser.NL, 0); } - public TerminalNode ASM_SYMBOLS(int i) { - return getToken(SerpentParser.ASM_SYMBOLS, i); - } - public List INT() { return getTokens(SerpentParser.INT); } - public List ASM_SYMBOLS() { return getTokens(SerpentParser.ASM_SYMBOLS); } - public TerminalNode INT(int i) { - return getToken(SerpentParser.INT, i); + public Asm_symbolContext asm_symbol() { + return getRuleContext(Asm_symbolContext.class,0); } public AsmContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); @@ -290,18 +285,68 @@ public class SerpentParser extends Parser { public final AsmContext asm() throws RecognitionException { AsmContext _localctx = new AsmContext(_ctx, getState()); enterRule(_localctx, 4, RULE_asm); + try { + enterOuterAlt(_localctx, 1); + { + setState(89); match(18); + setState(90); asm_symbol(); + setState(91); match(21); + setState(92); match(NL); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class Asm_symbolContext extends ParserRuleContext { + public TerminalNode ASM_SYMBOLS(int i) { + return getToken(SerpentParser.ASM_SYMBOLS, i); + } + public List INT() { return getTokens(SerpentParser.INT); } + public List ASM_SYMBOLS() { return getTokens(SerpentParser.ASM_SYMBOLS); } + public TerminalNode INT(int i) { + return getToken(SerpentParser.INT, i); + } + public Asm_symbolContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_asm_symbol; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof SerpentListener ) ((SerpentListener)listener).enterAsm_symbol(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof SerpentListener ) ((SerpentListener)listener).exitAsm_symbol(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof SerpentVisitor ) return ((SerpentVisitor)visitor).visitAsm_symbol(this); + else return visitor.visitChildren(this); + } + } + + public final Asm_symbolContext asm_symbol() throws RecognitionException { + Asm_symbolContext _localctx = new Asm_symbolContext(_ctx, getState()); + enterRule(_localctx, 6, RULE_asm_symbol); int _la; try { enterOuterAlt(_localctx, 1); { - setState(87); match(18); - setState(91); + setState(97); _errHandler.sync(this); _la = _input.LA(1); while (_la==INT || _la==ASM_SYMBOLS) { { { - setState(88); + setState(94); _la = _input.LA(1); if ( !(_la==INT || _la==ASM_SYMBOLS) ) { _errHandler.recoverInline(this); @@ -309,12 +354,10 @@ public class SerpentParser extends Parser { consume(); } } - setState(93); + setState(99); _errHandler.sync(this); _la = _input.LA(1); } - setState(94); match(21); - setState(95); match(NL); } } catch (RecognitionException re) { @@ -370,43 +413,43 @@ public class SerpentParser extends Parser { public final If_elif_else_stmtContext if_elif_else_stmt() throws RecognitionException { If_elif_else_stmtContext _localctx = new If_elif_else_stmtContext(_ctx, getState()); - enterRule(_localctx, 6, RULE_if_elif_else_stmt); + enterRule(_localctx, 8, RULE_if_elif_else_stmt); int _la; try { enterOuterAlt(_localctx, 1); { - setState(97); match(13); - setState(98); condition(); - setState(99); match(11); - setState(100); match(INDENT); - setState(101); block(); - setState(102); match(DEDENT); - setState(112); + setState(100); match(13); + setState(101); condition(); + setState(102); match(11); + setState(103); match(INDENT); + setState(104); block(); + setState(105); match(DEDENT); + setState(115); _errHandler.sync(this); _la = _input.LA(1); while (_la==14) { { { - setState(103); match(14); - setState(104); condition(); - setState(105); match(11); - setState(106); match(INDENT); - setState(107); block(); - setState(108); match(DEDENT); + setState(106); match(14); + setState(107); condition(); + setState(108); match(11); + setState(109); match(INDENT); + setState(110); block(); + setState(111); match(DEDENT); } } - setState(114); + setState(117); _errHandler.sync(this); _la = _input.LA(1); } - setState(120); + setState(123); _la = _input.LA(1); if (_la==5) { { - setState(115); match(5); - setState(116); match(INDENT); - setState(117); block(); - setState(118); match(DEDENT); + setState(118); match(5); + setState(119); match(INDENT); + setState(120); block(); + setState(121); match(DEDENT); } } @@ -453,16 +496,16 @@ public class SerpentParser extends Parser { public final While_stmtContext while_stmt() throws RecognitionException { While_stmtContext _localctx = new While_stmtContext(_ctx, getState()); - enterRule(_localctx, 8, RULE_while_stmt); + enterRule(_localctx, 10, RULE_while_stmt); try { enterOuterAlt(_localctx, 1); { - setState(122); match(8); - setState(123); condition(); - setState(124); match(11); - setState(125); match(INDENT); - setState(126); block(); - setState(127); match(DEDENT); + setState(125); match(8); + setState(126); condition(); + setState(127); match(11); + setState(128); match(INDENT); + setState(129); block(); + setState(130); match(DEDENT); } } catch (RecognitionException re) { @@ -537,86 +580,86 @@ public class SerpentParser extends Parser { public final Special_funcContext special_func() throws RecognitionException { Special_funcContext _localctx = new Special_funcContext(_ctx, getState()); - enterRule(_localctx, 10, RULE_special_func); + enterRule(_localctx, 12, RULE_special_func); try { - setState(142); + setState(145); switch (_input.LA(1)) { case 1: enterOuterAlt(_localctx, 1); { - setState(129); msg_datasize(); + setState(132); msg_datasize(); } break; case 16: enterOuterAlt(_localctx, 2); { - setState(130); msg_sender(); + setState(133); msg_sender(); } break; case 19: enterOuterAlt(_localctx, 3); { - setState(131); msg_value(); + setState(134); msg_value(); } break; case 4: enterOuterAlt(_localctx, 4); { - setState(132); tx_gasprice(); + setState(135); tx_gasprice(); } break; case 7: enterOuterAlt(_localctx, 5); { - setState(133); tx_origin(); + setState(136); tx_origin(); } break; case 9: enterOuterAlt(_localctx, 6); { - setState(134); tx_gas(); + setState(137); tx_gas(); } break; case 20: enterOuterAlt(_localctx, 7); { - setState(135); contract_balance(); + setState(138); contract_balance(); } break; case 23: enterOuterAlt(_localctx, 8); { - setState(136); block_prevhash(); + setState(139); block_prevhash(); } break; case 2: enterOuterAlt(_localctx, 9); { - setState(137); block_coinbase(); + setState(140); block_coinbase(); } break; case 17: enterOuterAlt(_localctx, 10); { - setState(138); block_timestamp(); + setState(141); block_timestamp(); } break; case 24: enterOuterAlt(_localctx, 11); { - setState(139); block_number(); + setState(142); block_number(); } break; case 25: enterOuterAlt(_localctx, 12); { - setState(140); block_difficulty(); + setState(143); block_difficulty(); } break; case 22: enterOuterAlt(_localctx, 13); { - setState(141); block_gaslimit(); + setState(144); block_gaslimit(); } break; default: @@ -656,11 +699,11 @@ public class SerpentParser extends Parser { public final Msg_datasizeContext msg_datasize() throws RecognitionException { Msg_datasizeContext _localctx = new Msg_datasizeContext(_ctx, getState()); - enterRule(_localctx, 12, RULE_msg_datasize); + enterRule(_localctx, 14, RULE_msg_datasize); try { enterOuterAlt(_localctx, 1); { - setState(144); match(1); + setState(147); match(1); } } catch (RecognitionException re) { @@ -696,11 +739,11 @@ public class SerpentParser extends Parser { public final Msg_senderContext msg_sender() throws RecognitionException { Msg_senderContext _localctx = new Msg_senderContext(_ctx, getState()); - enterRule(_localctx, 14, RULE_msg_sender); + enterRule(_localctx, 16, RULE_msg_sender); try { enterOuterAlt(_localctx, 1); { - setState(146); match(16); + setState(149); match(16); } } catch (RecognitionException re) { @@ -736,11 +779,11 @@ public class SerpentParser extends Parser { public final Msg_valueContext msg_value() throws RecognitionException { Msg_valueContext _localctx = new Msg_valueContext(_ctx, getState()); - enterRule(_localctx, 16, RULE_msg_value); + enterRule(_localctx, 18, RULE_msg_value); try { enterOuterAlt(_localctx, 1); { - setState(148); match(19); + setState(151); match(19); } } catch (RecognitionException re) { @@ -776,11 +819,11 @@ public class SerpentParser extends Parser { public final Tx_gaspriceContext tx_gasprice() throws RecognitionException { Tx_gaspriceContext _localctx = new Tx_gaspriceContext(_ctx, getState()); - enterRule(_localctx, 18, RULE_tx_gasprice); + enterRule(_localctx, 20, RULE_tx_gasprice); try { enterOuterAlt(_localctx, 1); { - setState(150); match(4); + setState(153); match(4); } } catch (RecognitionException re) { @@ -816,11 +859,11 @@ public class SerpentParser extends Parser { public final Tx_originContext tx_origin() throws RecognitionException { Tx_originContext _localctx = new Tx_originContext(_ctx, getState()); - enterRule(_localctx, 20, RULE_tx_origin); + enterRule(_localctx, 22, RULE_tx_origin); try { enterOuterAlt(_localctx, 1); { - setState(152); match(7); + setState(155); match(7); } } catch (RecognitionException re) { @@ -856,11 +899,11 @@ public class SerpentParser extends Parser { public final Tx_gasContext tx_gas() throws RecognitionException { Tx_gasContext _localctx = new Tx_gasContext(_ctx, getState()); - enterRule(_localctx, 22, RULE_tx_gas); + enterRule(_localctx, 24, RULE_tx_gas); try { enterOuterAlt(_localctx, 1); { - setState(154); match(9); + setState(157); match(9); } } catch (RecognitionException re) { @@ -896,11 +939,11 @@ public class SerpentParser extends Parser { public final Contract_balanceContext contract_balance() throws RecognitionException { Contract_balanceContext _localctx = new Contract_balanceContext(_ctx, getState()); - enterRule(_localctx, 24, RULE_contract_balance); + enterRule(_localctx, 26, RULE_contract_balance); try { enterOuterAlt(_localctx, 1); { - setState(156); match(20); + setState(159); match(20); } } catch (RecognitionException re) { @@ -936,11 +979,11 @@ public class SerpentParser extends Parser { public final Block_prevhashContext block_prevhash() throws RecognitionException { Block_prevhashContext _localctx = new Block_prevhashContext(_ctx, getState()); - enterRule(_localctx, 26, RULE_block_prevhash); + enterRule(_localctx, 28, RULE_block_prevhash); try { enterOuterAlt(_localctx, 1); { - setState(158); match(23); + setState(161); match(23); } } catch (RecognitionException re) { @@ -976,11 +1019,11 @@ public class SerpentParser extends Parser { public final Block_coinbaseContext block_coinbase() throws RecognitionException { Block_coinbaseContext _localctx = new Block_coinbaseContext(_ctx, getState()); - enterRule(_localctx, 28, RULE_block_coinbase); + enterRule(_localctx, 30, RULE_block_coinbase); try { enterOuterAlt(_localctx, 1); { - setState(160); match(2); + setState(163); match(2); } } catch (RecognitionException re) { @@ -1016,11 +1059,11 @@ public class SerpentParser extends Parser { public final Block_timestampContext block_timestamp() throws RecognitionException { Block_timestampContext _localctx = new Block_timestampContext(_ctx, getState()); - enterRule(_localctx, 30, RULE_block_timestamp); + enterRule(_localctx, 32, RULE_block_timestamp); try { enterOuterAlt(_localctx, 1); { - setState(162); match(17); + setState(165); match(17); } } catch (RecognitionException re) { @@ -1056,11 +1099,11 @@ public class SerpentParser extends Parser { public final Block_numberContext block_number() throws RecognitionException { Block_numberContext _localctx = new Block_numberContext(_ctx, getState()); - enterRule(_localctx, 32, RULE_block_number); + enterRule(_localctx, 34, RULE_block_number); try { enterOuterAlt(_localctx, 1); { - setState(164); match(24); + setState(167); match(24); } } catch (RecognitionException re) { @@ -1096,11 +1139,11 @@ public class SerpentParser extends Parser { public final Block_difficultyContext block_difficulty() throws RecognitionException { Block_difficultyContext _localctx = new Block_difficultyContext(_ctx, getState()); - enterRule(_localctx, 34, RULE_block_difficulty); + enterRule(_localctx, 36, RULE_block_difficulty); try { enterOuterAlt(_localctx, 1); { - setState(166); match(25); + setState(169); match(25); } } catch (RecognitionException re) { @@ -1136,11 +1179,11 @@ public class SerpentParser extends Parser { public final Block_gaslimitContext block_gaslimit() throws RecognitionException { Block_gaslimitContext _localctx = new Block_gaslimitContext(_ctx, getState()); - enterRule(_localctx, 36, RULE_block_gaslimit); + enterRule(_localctx, 38, RULE_block_gaslimit); try { enterOuterAlt(_localctx, 1); { - setState(168); match(22); + setState(171); match(22); } } catch (RecognitionException re) { @@ -1182,22 +1225,22 @@ public class SerpentParser extends Parser { public final Msg_funcContext msg_func() throws RecognitionException { Msg_funcContext _localctx = new Msg_funcContext(_ctx, getState()); - enterRule(_localctx, 38, RULE_msg_func); + enterRule(_localctx, 40, RULE_msg_func); try { enterOuterAlt(_localctx, 1); { - setState(170); match(10); - setState(171); match(12); - setState(172); int_val(); - setState(173); match(6); - setState(174); int_val(); - setState(175); match(6); - setState(176); int_val(); - setState(177); match(6); - setState(178); int_val(); - setState(179); match(6); - setState(180); int_val(); - setState(181); match(3); + setState(173); match(10); + setState(174); match(12); + setState(175); int_val(); + setState(176); match(6); + setState(177); int_val(); + setState(178); match(6); + setState(179); int_val(); + setState(180); match(6); + setState(181); int_val(); + setState(182); match(6); + setState(183); int_val(); + setState(184); match(3); } } catch (RecognitionException re) { @@ -1239,14 +1282,14 @@ public class SerpentParser extends Parser { public final AssignContext assign() throws RecognitionException { AssignContext _localctx = new AssignContext(_ctx, getState()); - enterRule(_localctx, 40, RULE_assign); + enterRule(_localctx, 42, RULE_assign); try { enterOuterAlt(_localctx, 1); { - setState(183); match(VAR); - setState(184); match(EQ_OP); - setState(185); expression(); - setState(186); match(NL); + setState(186); match(VAR); + setState(187); match(EQ_OP); + setState(188); expression(); + setState(189); match(NL); } } catch (RecognitionException re) { @@ -1295,17 +1338,17 @@ public class SerpentParser extends Parser { int _parentState = getState(); Mul_exprContext _localctx = new Mul_exprContext(_ctx, _parentState, _p); Mul_exprContext _prevctx = _localctx; - int _startState = 42; + int _startState = 44; enterRecursionRule(_localctx, RULE_mul_expr); try { int _alt; enterOuterAlt(_localctx, 1); { { - setState(189); int_val(); + setState(192); int_val(); } _ctx.stop = _input.LT(-1); - setState(196); + setState(199); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,6,_ctx); while ( _alt!=2 && _alt!=-1 ) { @@ -1316,14 +1359,14 @@ public class SerpentParser extends Parser { { _localctx = new Mul_exprContext(_parentctx, _parentState, _p); pushNewRecursionContext(_localctx, _startState, RULE_mul_expr); - setState(191); + setState(194); if (!(1 >= _localctx._p)) throw new FailedPredicateException(this, "1 >= $_p"); - setState(192); match(OP_MUL); - setState(193); int_val(); + setState(195); match(OP_MUL); + setState(196); int_val(); } } } - setState(198); + setState(201); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,6,_ctx); } @@ -1375,17 +1418,17 @@ public class SerpentParser extends Parser { int _parentState = getState(); Add_exprContext _localctx = new Add_exprContext(_ctx, _parentState, _p); Add_exprContext _prevctx = _localctx; - int _startState = 44; + int _startState = 46; enterRecursionRule(_localctx, RULE_add_expr); try { int _alt; enterOuterAlt(_localctx, 1); { { - setState(200); mul_expr(0); + setState(203); mul_expr(0); } _ctx.stop = _input.LT(-1); - setState(207); + setState(210); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,7,_ctx); while ( _alt!=2 && _alt!=-1 ) { @@ -1396,14 +1439,14 @@ public class SerpentParser extends Parser { { _localctx = new Add_exprContext(_parentctx, _parentState, _p); pushNewRecursionContext(_localctx, _startState, RULE_add_expr); - setState(202); + setState(205); if (!(1 >= _localctx._p)) throw new FailedPredicateException(this, "1 >= $_p"); - setState(203); match(OP_ADD); - setState(204); mul_expr(0); + setState(206); match(OP_ADD); + setState(207); mul_expr(0); } } } - setState(209); + setState(212); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,7,_ctx); } @@ -1455,17 +1498,17 @@ public class SerpentParser extends Parser { int _parentState = getState(); Rel_expContext _localctx = new Rel_expContext(_ctx, _parentState, _p); Rel_expContext _prevctx = _localctx; - int _startState = 46; + int _startState = 48; enterRecursionRule(_localctx, RULE_rel_exp); try { int _alt; enterOuterAlt(_localctx, 1); { { - setState(211); add_expr(0); + setState(214); add_expr(0); } _ctx.stop = _input.LT(-1); - setState(218); + setState(221); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,8,_ctx); while ( _alt!=2 && _alt!=-1 ) { @@ -1476,14 +1519,14 @@ public class SerpentParser extends Parser { { _localctx = new Rel_expContext(_parentctx, _parentState, _p); pushNewRecursionContext(_localctx, _startState, RULE_rel_exp); - setState(213); + setState(216); if (!(1 >= _localctx._p)) throw new FailedPredicateException(this, "1 >= $_p"); - setState(214); match(OP_REL); - setState(215); add_expr(0); + setState(217); match(OP_REL); + setState(218); add_expr(0); } } } - setState(220); + setState(223); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,8,_ctx); } @@ -1535,17 +1578,17 @@ public class SerpentParser extends Parser { int _parentState = getState(); Eq_expContext _localctx = new Eq_expContext(_ctx, _parentState, _p); Eq_expContext _prevctx = _localctx; - int _startState = 48; + int _startState = 50; enterRecursionRule(_localctx, RULE_eq_exp); try { int _alt; enterOuterAlt(_localctx, 1); { { - setState(222); rel_exp(0); + setState(225); rel_exp(0); } _ctx.stop = _input.LT(-1); - setState(229); + setState(232); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,9,_ctx); while ( _alt!=2 && _alt!=-1 ) { @@ -1556,14 +1599,14 @@ public class SerpentParser extends Parser { { _localctx = new Eq_expContext(_parentctx, _parentState, _p); pushNewRecursionContext(_localctx, _startState, RULE_eq_exp); - setState(224); + setState(227); if (!(1 >= _localctx._p)) throw new FailedPredicateException(this, "1 >= $_p"); - setState(225); match(OP_EQ); - setState(226); rel_exp(0); + setState(228); match(OP_EQ); + setState(229); rel_exp(0); } } } - setState(231); + setState(234); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,9,_ctx); } @@ -1615,17 +1658,17 @@ public class SerpentParser extends Parser { int _parentState = getState(); And_expContext _localctx = new And_expContext(_ctx, _parentState, _p); And_expContext _prevctx = _localctx; - int _startState = 50; + int _startState = 52; enterRecursionRule(_localctx, RULE_and_exp); try { int _alt; enterOuterAlt(_localctx, 1); { { - setState(233); eq_exp(0); + setState(236); eq_exp(0); } _ctx.stop = _input.LT(-1); - setState(240); + setState(243); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,10,_ctx); while ( _alt!=2 && _alt!=-1 ) { @@ -1636,14 +1679,14 @@ public class SerpentParser extends Parser { { _localctx = new And_expContext(_parentctx, _parentState, _p); pushNewRecursionContext(_localctx, _startState, RULE_and_exp); - setState(235); + setState(238); if (!(1 >= _localctx._p)) throw new FailedPredicateException(this, "1 >= $_p"); - setState(236); match(OP_AND); - setState(237); eq_exp(0); + setState(239); match(OP_AND); + setState(240); eq_exp(0); } } } - setState(242); + setState(245); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,10,_ctx); } @@ -1695,17 +1738,17 @@ public class SerpentParser extends Parser { int _parentState = getState(); Ex_or_expContext _localctx = new Ex_or_expContext(_ctx, _parentState, _p); Ex_or_expContext _prevctx = _localctx; - int _startState = 52; + int _startState = 54; enterRecursionRule(_localctx, RULE_ex_or_exp); try { int _alt; enterOuterAlt(_localctx, 1); { { - setState(244); and_exp(0); + setState(247); and_exp(0); } _ctx.stop = _input.LT(-1); - setState(251); + setState(254); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,11,_ctx); while ( _alt!=2 && _alt!=-1 ) { @@ -1716,14 +1759,14 @@ public class SerpentParser extends Parser { { _localctx = new Ex_or_expContext(_parentctx, _parentState, _p); pushNewRecursionContext(_localctx, _startState, RULE_ex_or_exp); - setState(246); + setState(249); if (!(1 >= _localctx._p)) throw new FailedPredicateException(this, "1 >= $_p"); - setState(247); match(OP_EX_OR); - setState(248); and_exp(0); + setState(250); match(OP_EX_OR); + setState(251); and_exp(0); } } } - setState(253); + setState(256); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,11,_ctx); } @@ -1775,17 +1818,17 @@ public class SerpentParser extends Parser { int _parentState = getState(); In_or_expContext _localctx = new In_or_expContext(_ctx, _parentState, _p); In_or_expContext _prevctx = _localctx; - int _startState = 54; + int _startState = 56; enterRecursionRule(_localctx, RULE_in_or_exp); try { int _alt; enterOuterAlt(_localctx, 1); { { - setState(255); ex_or_exp(0); + setState(258); ex_or_exp(0); } _ctx.stop = _input.LT(-1); - setState(262); + setState(265); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,12,_ctx); while ( _alt!=2 && _alt!=-1 ) { @@ -1796,14 +1839,14 @@ public class SerpentParser extends Parser { { _localctx = new In_or_expContext(_parentctx, _parentState, _p); pushNewRecursionContext(_localctx, _startState, RULE_in_or_exp); - setState(257); + setState(260); if (!(1 >= _localctx._p)) throw new FailedPredicateException(this, "1 >= $_p"); - setState(258); match(OP_IN_OR); - setState(259); ex_or_exp(0); + setState(261); match(OP_IN_OR); + setState(262); ex_or_exp(0); } } } - setState(264); + setState(267); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,12,_ctx); } @@ -1855,17 +1898,17 @@ public class SerpentParser extends Parser { int _parentState = getState(); Log_and_expContext _localctx = new Log_and_expContext(_ctx, _parentState, _p); Log_and_expContext _prevctx = _localctx; - int _startState = 56; + int _startState = 58; enterRecursionRule(_localctx, RULE_log_and_exp); try { int _alt; enterOuterAlt(_localctx, 1); { { - setState(266); in_or_exp(0); + setState(269); in_or_exp(0); } _ctx.stop = _input.LT(-1); - setState(273); + setState(276); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,13,_ctx); while ( _alt!=2 && _alt!=-1 ) { @@ -1876,14 +1919,14 @@ public class SerpentParser extends Parser { { _localctx = new Log_and_expContext(_parentctx, _parentState, _p); pushNewRecursionContext(_localctx, _startState, RULE_log_and_exp); - setState(268); + setState(271); if (!(1 >= _localctx._p)) throw new FailedPredicateException(this, "1 >= $_p"); - setState(269); match(OP_LOG_AND); - setState(270); in_or_exp(0); + setState(272); match(OP_LOG_AND); + setState(273); in_or_exp(0); } } } - setState(275); + setState(278); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,13,_ctx); } @@ -1935,17 +1978,17 @@ public class SerpentParser extends Parser { int _parentState = getState(); Log_or_expContext _localctx = new Log_or_expContext(_ctx, _parentState, _p); Log_or_expContext _prevctx = _localctx; - int _startState = 58; + int _startState = 60; enterRecursionRule(_localctx, RULE_log_or_exp); try { int _alt; enterOuterAlt(_localctx, 1); { { - setState(277); log_and_exp(0); + setState(280); log_and_exp(0); } _ctx.stop = _input.LT(-1); - setState(284); + setState(287); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,14,_ctx); while ( _alt!=2 && _alt!=-1 ) { @@ -1956,14 +1999,14 @@ public class SerpentParser extends Parser { { _localctx = new Log_or_expContext(_parentctx, _parentState, _p); pushNewRecursionContext(_localctx, _startState, RULE_log_or_exp); - setState(279); + setState(282); if (!(1 >= _localctx._p)) throw new FailedPredicateException(this, "1 >= $_p"); - setState(280); match(OP_LOG_OR); - setState(281); log_and_exp(0); + setState(283); match(OP_LOG_OR); + setState(284); log_and_exp(0); } } } - setState(286); + setState(289); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,14,_ctx); } @@ -2005,11 +2048,11 @@ public class SerpentParser extends Parser { public final ExpressionContext expression() throws RecognitionException { ExpressionContext _localctx = new ExpressionContext(_ctx, getState()); - enterRule(_localctx, 60, RULE_expression); + enterRule(_localctx, 62, RULE_expression); try { enterOuterAlt(_localctx, 1); { - setState(287); log_or_exp(0); + setState(290); log_or_exp(0); } } catch (RecognitionException re) { @@ -2048,11 +2091,11 @@ public class SerpentParser extends Parser { public final ConditionContext condition() throws RecognitionException { ConditionContext _localctx = new ConditionContext(_ctx, getState()); - enterRule(_localctx, 62, RULE_condition); + enterRule(_localctx, 64, RULE_condition); try { enterOuterAlt(_localctx, 1); { - setState(289); expression(); + setState(292); expression(); } } catch (RecognitionException re) { @@ -2105,26 +2148,26 @@ public class SerpentParser extends Parser { public final Int_valContext int_val() throws RecognitionException { Int_valContext _localctx = new Int_valContext(_ctx, getState()); - enterRule(_localctx, 64, RULE_int_val); + enterRule(_localctx, 66, RULE_int_val); try { - setState(305); + setState(308); switch (_input.LA(1)) { case INT: enterOuterAlt(_localctx, 1); { - setState(291); match(INT); + setState(294); match(INT); } break; case HEX_NUMBER: enterOuterAlt(_localctx, 2); { - setState(292); hex_num(); + setState(295); hex_num(); } break; case VAR: enterOuterAlt(_localctx, 3); { - setState(293); get_var(); + setState(296); get_var(); } break; case 1: @@ -2142,30 +2185,30 @@ public class SerpentParser extends Parser { case 25: enterOuterAlt(_localctx, 4); { - setState(294); special_func(); + setState(297); special_func(); } break; case 12: enterOuterAlt(_localctx, 5); { - setState(295); match(12); - setState(296); expression(); - setState(297); match(3); + setState(298); match(12); + setState(299); expression(); + setState(300); match(3); } break; case OP_NOT: enterOuterAlt(_localctx, 6); { - setState(299); match(OP_NOT); - setState(300); match(12); - setState(301); expression(); - setState(302); match(3); + setState(302); match(OP_NOT); + setState(303); match(12); + setState(304); expression(); + setState(305); match(3); } break; case 10: enterOuterAlt(_localctx, 7); { - setState(304); msg_func(); + setState(307); msg_func(); } break; default: @@ -2206,11 +2249,11 @@ public class SerpentParser extends Parser { public final Hex_numContext hex_num() throws RecognitionException { Hex_numContext _localctx = new Hex_numContext(_ctx, getState()); - enterRule(_localctx, 66, RULE_hex_num); + enterRule(_localctx, 68, RULE_hex_num); try { enterOuterAlt(_localctx, 1); { - setState(307); match(HEX_NUMBER); + setState(310); match(HEX_NUMBER); } } catch (RecognitionException re) { @@ -2248,15 +2291,15 @@ public class SerpentParser extends Parser { public final Ret_funcContext ret_func() throws RecognitionException { Ret_funcContext _localctx = new Ret_funcContext(_ctx, getState()); - enterRule(_localctx, 68, RULE_ret_func); + enterRule(_localctx, 70, RULE_ret_func); try { enterOuterAlt(_localctx, 1); { - setState(309); match(15); - setState(310); match(12); - setState(311); match(INT); - setState(312); match(3); - setState(313); match(NL); + setState(312); match(15); + setState(313); match(12); + setState(314); match(INT); + setState(315); match(3); + setState(316); match(NL); } } catch (RecognitionException re) { @@ -2293,11 +2336,11 @@ public class SerpentParser extends Parser { public final Get_varContext get_var() throws RecognitionException { Get_varContext _localctx = new Get_varContext(_ctx, getState()); - enterRule(_localctx, 70, RULE_get_var); + enterRule(_localctx, 72, RULE_get_var); try { enterOuterAlt(_localctx, 1); { - setState(315); match(VAR); + setState(318); match(VAR); } } catch (RecognitionException re) { @@ -2313,23 +2356,23 @@ public class SerpentParser extends Parser { public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { switch (ruleIndex) { - case 21: return mul_expr_sempred((Mul_exprContext)_localctx, predIndex); + case 22: return mul_expr_sempred((Mul_exprContext)_localctx, predIndex); - case 22: return add_expr_sempred((Add_exprContext)_localctx, predIndex); + case 23: return add_expr_sempred((Add_exprContext)_localctx, predIndex); - case 23: return rel_exp_sempred((Rel_expContext)_localctx, predIndex); + case 24: return rel_exp_sempred((Rel_expContext)_localctx, predIndex); - case 24: return eq_exp_sempred((Eq_expContext)_localctx, predIndex); + case 25: return eq_exp_sempred((Eq_expContext)_localctx, predIndex); - case 25: return and_exp_sempred((And_expContext)_localctx, predIndex); + case 26: return and_exp_sempred((And_expContext)_localctx, predIndex); - case 26: return ex_or_exp_sempred((Ex_or_expContext)_localctx, predIndex); + case 27: return ex_or_exp_sempred((Ex_or_expContext)_localctx, predIndex); - case 27: return in_or_exp_sempred((In_or_expContext)_localctx, predIndex); + case 28: return in_or_exp_sempred((In_or_expContext)_localctx, predIndex); - case 28: return log_and_exp_sempred((Log_and_expContext)_localctx, predIndex); + case 29: return log_and_exp_sempred((Log_and_expContext)_localctx, predIndex); - case 29: return log_or_exp_sempred((Log_or_expContext)_localctx, predIndex); + case 30: return log_or_exp_sempred((Log_or_expContext)_localctx, predIndex); } return true; } @@ -2389,110 +2432,110 @@ public class SerpentParser extends Parser { } public static final String _serializedATN = - "\3\uacf5\uee8c\u4f5d\u8b0d\u4a45\u78bd\u1b2f\u3378\3\60\u0140\4\2\t\2"+ + "\3\uacf5\uee8c\u4f5d\u8b0d\u4a45\u78bd\u1b2f\u3378\3\60\u0143\4\2\t\2"+ "\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+ "\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+ "\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+ "\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+ - "\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\3\3\3\3"+ - "\7\3U\n\3\f\3\16\3X\13\3\3\4\3\4\7\4\\\n\4\f\4\16\4_\13\4\3\4\3\4\3\4"+ - "\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\7\5q\n\5\f\5\16\5"+ - "t\13\5\3\5\3\5\3\5\3\5\3\5\5\5{\n\5\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\7\3"+ - "\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\5\7\u0091\n\7\3\b\3\b\3"+ + "\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\3"+ + "\3\3\3\7\3W\n\3\f\3\16\3Z\13\3\3\4\3\4\3\4\3\4\3\4\3\5\7\5b\n\5\f\5\16"+ + "\5e\13\5\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\7\6t\n\6"+ + "\f\6\16\6w\13\6\3\6\3\6\3\6\3\6\3\6\5\6~\n\6\3\7\3\7\3\7\3\7\3\7\3\7\3"+ + "\7\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\5\b\u0094\n\b\3"+ "\t\3\t\3\n\3\n\3\13\3\13\3\f\3\f\3\r\3\r\3\16\3\16\3\17\3\17\3\20\3\20"+ - "\3\21\3\21\3\22\3\22\3\23\3\23\3\24\3\24\3\25\3\25\3\25\3\25\3\25\3\25"+ - "\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\26\3\26\3\26\3\26\3\26\3\27\3\27"+ - "\3\27\3\27\3\27\3\27\7\27\u00c5\n\27\f\27\16\27\u00c8\13\27\3\30\3\30"+ - "\3\30\3\30\3\30\3\30\7\30\u00d0\n\30\f\30\16\30\u00d3\13\30\3\31\3\31"+ - "\3\31\3\31\3\31\3\31\7\31\u00db\n\31\f\31\16\31\u00de\13\31\3\32\3\32"+ - "\3\32\3\32\3\32\3\32\7\32\u00e6\n\32\f\32\16\32\u00e9\13\32\3\33\3\33"+ - "\3\33\3\33\3\33\3\33\7\33\u00f1\n\33\f\33\16\33\u00f4\13\33\3\34\3\34"+ - "\3\34\3\34\3\34\3\34\7\34\u00fc\n\34\f\34\16\34\u00ff\13\34\3\35\3\35"+ - "\3\35\3\35\3\35\3\35\7\35\u0107\n\35\f\35\16\35\u010a\13\35\3\36\3\36"+ - "\3\36\3\36\3\36\3\36\7\36\u0112\n\36\f\36\16\36\u0115\13\36\3\37\3\37"+ - "\3\37\3\37\3\37\3\37\7\37\u011d\n\37\f\37\16\37\u0120\13\37\3 \3 \3!\3"+ - "!\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\5\"\u0134\n"+ - "\"\3#\3#\3$\3$\3$\3$\3$\3$\3%\3%\3%\2&\2\4\6\b\n\f\16\20\22\24\26\30\32"+ - "\34\36 \"$&(*,.\60\62\64\668:<>@BDFH\2\3\3\2\34\35\u0140\2J\3\2\2\2\4"+ - "V\3\2\2\2\6Y\3\2\2\2\bc\3\2\2\2\n|\3\2\2\2\f\u0090\3\2\2\2\16\u0092\3"+ - "\2\2\2\20\u0094\3\2\2\2\22\u0096\3\2\2\2\24\u0098\3\2\2\2\26\u009a\3\2"+ - "\2\2\30\u009c\3\2\2\2\32\u009e\3\2\2\2\34\u00a0\3\2\2\2\36\u00a2\3\2\2"+ - "\2 \u00a4\3\2\2\2\"\u00a6\3\2\2\2$\u00a8\3\2\2\2&\u00aa\3\2\2\2(\u00ac"+ - "\3\2\2\2*\u00b9\3\2\2\2,\u00be\3\2\2\2.\u00c9\3\2\2\2\60\u00d4\3\2\2\2"+ - "\62\u00df\3\2\2\2\64\u00ea\3\2\2\2\66\u00f5\3\2\2\28\u0100\3\2\2\2:\u010b"+ - "\3\2\2\2<\u0116\3\2\2\2>\u0121\3\2\2\2@\u0123\3\2\2\2B\u0133\3\2\2\2D"+ - "\u0135\3\2\2\2F\u0137\3\2\2\2H\u013d\3\2\2\2JK\5\4\3\2KL\7\2\2\3L\3\3"+ - "\2\2\2MU\5\6\4\2NU\5*\26\2OU\5\f\7\2PU\5\b\5\2QU\5\n\6\2RU\5F$\2SU\5("+ - "\25\2TM\3\2\2\2TN\3\2\2\2TO\3\2\2\2TP\3\2\2\2TQ\3\2\2\2TR\3\2\2\2TS\3"+ - "\2\2\2UX\3\2\2\2VT\3\2\2\2VW\3\2\2\2W\5\3\2\2\2XV\3\2\2\2Y]\7\24\2\2Z"+ - "\\\t\2\2\2[Z\3\2\2\2\\_\3\2\2\2][\3\2\2\2]^\3\2\2\2^`\3\2\2\2_]\3\2\2"+ - "\2`a\7\27\2\2ab\7#\2\2b\7\3\2\2\2cd\7\17\2\2de\5@!\2ef\7\r\2\2fg\7/\2"+ - "\2gh\5\4\3\2hr\7\60\2\2ij\7\20\2\2jk\5@!\2kl\7\r\2\2lm\7/\2\2mn\5\4\3"+ - "\2no\7\60\2\2oq\3\2\2\2pi\3\2\2\2qt\3\2\2\2rp\3\2\2\2rs\3\2\2\2sz\3\2"+ - "\2\2tr\3\2\2\2uv\7\7\2\2vw\7/\2\2wx\5\4\3\2xy\7\60\2\2y{\3\2\2\2zu\3\2"+ - "\2\2z{\3\2\2\2{\t\3\2\2\2|}\7\n\2\2}~\5@!\2~\177\7\r\2\2\177\u0080\7/"+ - "\2\2\u0080\u0081\5\4\3\2\u0081\u0082\7\60\2\2\u0082\13\3\2\2\2\u0083\u0091"+ - "\5\16\b\2\u0084\u0091\5\20\t\2\u0085\u0091\5\22\n\2\u0086\u0091\5\24\13"+ - "\2\u0087\u0091\5\26\f\2\u0088\u0091\5\30\r\2\u0089\u0091\5\32\16\2\u008a"+ - "\u0091\5\34\17\2\u008b\u0091\5\36\20\2\u008c\u0091\5 \21\2\u008d\u0091"+ - "\5\"\22\2\u008e\u0091\5$\23\2\u008f\u0091\5&\24\2\u0090\u0083\3\2\2\2"+ - "\u0090\u0084\3\2\2\2\u0090\u0085\3\2\2\2\u0090\u0086\3\2\2\2\u0090\u0087"+ - "\3\2\2\2\u0090\u0088\3\2\2\2\u0090\u0089\3\2\2\2\u0090\u008a\3\2\2\2\u0090"+ - "\u008b\3\2\2\2\u0090\u008c\3\2\2\2\u0090\u008d\3\2\2\2\u0090\u008e\3\2"+ - "\2\2\u0090\u008f\3\2\2\2\u0091\r\3\2\2\2\u0092\u0093\7\3\2\2\u0093\17"+ - "\3\2\2\2\u0094\u0095\7\22\2\2\u0095\21\3\2\2\2\u0096\u0097\7\25\2\2\u0097"+ - "\23\3\2\2\2\u0098\u0099\7\6\2\2\u0099\25\3\2\2\2\u009a\u009b\7\t\2\2\u009b"+ - "\27\3\2\2\2\u009c\u009d\7\13\2\2\u009d\31\3\2\2\2\u009e\u009f\7\26\2\2"+ - "\u009f\33\3\2\2\2\u00a0\u00a1\7\31\2\2\u00a1\35\3\2\2\2\u00a2\u00a3\7"+ - "\4\2\2\u00a3\37\3\2\2\2\u00a4\u00a5\7\23\2\2\u00a5!\3\2\2\2\u00a6\u00a7"+ - "\7\32\2\2\u00a7#\3\2\2\2\u00a8\u00a9\7\33\2\2\u00a9%\3\2\2\2\u00aa\u00ab"+ - "\7\30\2\2\u00ab\'\3\2\2\2\u00ac\u00ad\7\f\2\2\u00ad\u00ae\7\16\2\2\u00ae"+ - "\u00af\5B\"\2\u00af\u00b0\7\b\2\2\u00b0\u00b1\5B\"\2\u00b1\u00b2\7\b\2"+ - "\2\u00b2\u00b3\5B\"\2\u00b3\u00b4\7\b\2\2\u00b4\u00b5\5B\"\2\u00b5\u00b6"+ - "\7\b\2\2\u00b6\u00b7\5B\"\2\u00b7\u00b8\7\5\2\2\u00b8)\3\2\2\2\u00b9\u00ba"+ - "\7&\2\2\u00ba\u00bb\7\"\2\2\u00bb\u00bc\5> \2\u00bc\u00bd\7#\2\2\u00bd"+ - "+\3\2\2\2\u00be\u00bf\b\27\1\2\u00bf\u00c0\5B\"\2\u00c0\u00c6\3\2\2\2"+ - "\u00c1\u00c2\6\27\2\3\u00c2\u00c3\7(\2\2\u00c3\u00c5\5B\"\2\u00c4\u00c1"+ - "\3\2\2\2\u00c5\u00c8\3\2\2\2\u00c6\u00c4\3\2\2\2\u00c6\u00c7\3\2\2\2\u00c7"+ - "-\3\2\2\2\u00c8\u00c6\3\2\2\2\u00c9\u00ca\b\30\1\2\u00ca\u00cb\5,\27\2"+ - "\u00cb\u00d1\3\2\2\2\u00cc\u00cd\6\30\3\3\u00cd\u00ce\7\'\2\2\u00ce\u00d0"+ - "\5,\27\2\u00cf\u00cc\3\2\2\2\u00d0\u00d3\3\2\2\2\u00d1\u00cf\3\2\2\2\u00d1"+ - "\u00d2\3\2\2\2\u00d2/\3\2\2\2\u00d3\u00d1\3\2\2\2\u00d4\u00d5\b\31\1\2"+ - "\u00d5\u00d6\5.\30\2\u00d6\u00dc\3\2\2\2\u00d7\u00d8\6\31\4\3\u00d8\u00d9"+ - "\7)\2\2\u00d9\u00db\5.\30\2\u00da\u00d7\3\2\2\2\u00db\u00de\3\2\2\2\u00dc"+ - "\u00da\3\2\2\2\u00dc\u00dd\3\2\2\2\u00dd\61\3\2\2\2\u00de\u00dc\3\2\2"+ - "\2\u00df\u00e0\b\32\1\2\u00e0\u00e1\5\60\31\2\u00e1\u00e7\3\2\2\2\u00e2"+ - "\u00e3\6\32\5\3\u00e3\u00e4\7*\2\2\u00e4\u00e6\5\60\31\2\u00e5\u00e2\3"+ - "\2\2\2\u00e6\u00e9\3\2\2\2\u00e7\u00e5\3\2\2\2\u00e7\u00e8\3\2\2\2\u00e8"+ - "\63\3\2\2\2\u00e9\u00e7\3\2\2\2\u00ea\u00eb\b\33\1\2\u00eb\u00ec\5\62"+ - "\32\2\u00ec\u00f2\3\2\2\2\u00ed\u00ee\6\33\6\3\u00ee\u00ef\7+\2\2\u00ef"+ - "\u00f1\5\62\32\2\u00f0\u00ed\3\2\2\2\u00f1\u00f4\3\2\2\2\u00f2\u00f0\3"+ - "\2\2\2\u00f2\u00f3\3\2\2\2\u00f3\65\3\2\2\2\u00f4\u00f2\3\2\2\2\u00f5"+ - "\u00f6\b\34\1\2\u00f6\u00f7\5\64\33\2\u00f7\u00fd\3\2\2\2\u00f8\u00f9"+ - "\6\34\7\3\u00f9\u00fa\7\36\2\2\u00fa\u00fc\5\64\33\2\u00fb\u00f8\3\2\2"+ - "\2\u00fc\u00ff\3\2\2\2\u00fd\u00fb\3\2\2\2\u00fd\u00fe\3\2\2\2\u00fe\67"+ - "\3\2\2\2\u00ff\u00fd\3\2\2\2\u0100\u0101\b\35\1\2\u0101\u0102\5\66\34"+ - "\2\u0102\u0108\3\2\2\2\u0103\u0104\6\35\b\3\u0104\u0105\7,\2\2\u0105\u0107"+ - "\5\66\34\2\u0106\u0103\3\2\2\2\u0107\u010a\3\2\2\2\u0108\u0106\3\2\2\2"+ - "\u0108\u0109\3\2\2\2\u01099\3\2\2\2\u010a\u0108\3\2\2\2\u010b\u010c\b"+ - "\36\1\2\u010c\u010d\58\35\2\u010d\u0113\3\2\2\2\u010e\u010f\6\36\t\3\u010f"+ - "\u0110\7\37\2\2\u0110\u0112\58\35\2\u0111\u010e\3\2\2\2\u0112\u0115\3"+ - "\2\2\2\u0113\u0111\3\2\2\2\u0113\u0114\3\2\2\2\u0114;\3\2\2\2\u0115\u0113"+ - "\3\2\2\2\u0116\u0117\b\37\1\2\u0117\u0118\5:\36\2\u0118\u011e\3\2\2\2"+ - "\u0119\u011a\6\37\n\3\u011a\u011b\7 \2\2\u011b\u011d\5:\36\2\u011c\u0119"+ - "\3\2\2\2\u011d\u0120\3\2\2\2\u011e\u011c\3\2\2\2\u011e\u011f\3\2\2\2\u011f"+ - "=\3\2\2\2\u0120\u011e\3\2\2\2\u0121\u0122\5<\37\2\u0122?\3\2\2\2\u0123"+ - "\u0124\5> \2\u0124A\3\2\2\2\u0125\u0134\7\34\2\2\u0126\u0134\5D#\2\u0127"+ - "\u0134\5H%\2\u0128\u0134\5\f\7\2\u0129\u012a\7\16\2\2\u012a\u012b\5> "+ - "\2\u012b\u012c\7\5\2\2\u012c\u0134\3\2\2\2\u012d\u012e\7!\2\2\u012e\u012f"+ - "\7\16\2\2\u012f\u0130\5> \2\u0130\u0131\7\5\2\2\u0131\u0134\3\2\2\2\u0132"+ - "\u0134\5(\25\2\u0133\u0125\3\2\2\2\u0133\u0126\3\2\2\2\u0133\u0127\3\2"+ - "\2\2\u0133\u0128\3\2\2\2\u0133\u0129\3\2\2\2\u0133\u012d\3\2\2\2\u0133"+ - "\u0132\3\2\2\2\u0134C\3\2\2\2\u0135\u0136\7.\2\2\u0136E\3\2\2\2\u0137"+ - "\u0138\7\21\2\2\u0138\u0139\7\16\2\2\u0139\u013a\7\34\2\2\u013a\u013b"+ - "\7\5\2\2\u013b\u013c\7#\2\2\u013cG\3\2\2\2\u013d\u013e\7&\2\2\u013eI\3"+ - "\2\2\2\22TV]rz\u0090\u00c6\u00d1\u00dc\u00e7\u00f2\u00fd\u0108\u0113\u011e"+ - "\u0133"; + "\3\21\3\21\3\22\3\22\3\23\3\23\3\24\3\24\3\25\3\25\3\26\3\26\3\26\3\26"+ + "\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\27\3\27\3\27\3\27\3\27"+ + "\3\30\3\30\3\30\3\30\3\30\3\30\7\30\u00c8\n\30\f\30\16\30\u00cb\13\30"+ + "\3\31\3\31\3\31\3\31\3\31\3\31\7\31\u00d3\n\31\f\31\16\31\u00d6\13\31"+ + "\3\32\3\32\3\32\3\32\3\32\3\32\7\32\u00de\n\32\f\32\16\32\u00e1\13\32"+ + "\3\33\3\33\3\33\3\33\3\33\3\33\7\33\u00e9\n\33\f\33\16\33\u00ec\13\33"+ + "\3\34\3\34\3\34\3\34\3\34\3\34\7\34\u00f4\n\34\f\34\16\34\u00f7\13\34"+ + "\3\35\3\35\3\35\3\35\3\35\3\35\7\35\u00ff\n\35\f\35\16\35\u0102\13\35"+ + "\3\36\3\36\3\36\3\36\3\36\3\36\7\36\u010a\n\36\f\36\16\36\u010d\13\36"+ + "\3\37\3\37\3\37\3\37\3\37\3\37\7\37\u0115\n\37\f\37\16\37\u0118\13\37"+ + "\3 \3 \3 \3 \3 \3 \7 \u0120\n \f \16 \u0123\13 \3!\3!\3\"\3\"\3#\3#\3"+ + "#\3#\3#\3#\3#\3#\3#\3#\3#\3#\3#\3#\5#\u0137\n#\3$\3$\3%\3%\3%\3%\3%\3"+ + "%\3&\3&\3&\2\'\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\62\64"+ + "\668:<>@BDFHJ\2\3\3\2\34\35\u0142\2L\3\2\2\2\4X\3\2\2\2\6[\3\2\2\2\bc"+ + "\3\2\2\2\nf\3\2\2\2\f\177\3\2\2\2\16\u0093\3\2\2\2\20\u0095\3\2\2\2\22"+ + "\u0097\3\2\2\2\24\u0099\3\2\2\2\26\u009b\3\2\2\2\30\u009d\3\2\2\2\32\u009f"+ + "\3\2\2\2\34\u00a1\3\2\2\2\36\u00a3\3\2\2\2 \u00a5\3\2\2\2\"\u00a7\3\2"+ + "\2\2$\u00a9\3\2\2\2&\u00ab\3\2\2\2(\u00ad\3\2\2\2*\u00af\3\2\2\2,\u00bc"+ + "\3\2\2\2.\u00c1\3\2\2\2\60\u00cc\3\2\2\2\62\u00d7\3\2\2\2\64\u00e2\3\2"+ + "\2\2\66\u00ed\3\2\2\28\u00f8\3\2\2\2:\u0103\3\2\2\2<\u010e\3\2\2\2>\u0119"+ + "\3\2\2\2@\u0124\3\2\2\2B\u0126\3\2\2\2D\u0136\3\2\2\2F\u0138\3\2\2\2H"+ + "\u013a\3\2\2\2J\u0140\3\2\2\2LM\5\4\3\2MN\7\2\2\3N\3\3\2\2\2OW\5\6\4\2"+ + "PW\5,\27\2QW\5\16\b\2RW\5\n\6\2SW\5\f\7\2TW\5H%\2UW\5*\26\2VO\3\2\2\2"+ + "VP\3\2\2\2VQ\3\2\2\2VR\3\2\2\2VS\3\2\2\2VT\3\2\2\2VU\3\2\2\2WZ\3\2\2\2"+ + "XV\3\2\2\2XY\3\2\2\2Y\5\3\2\2\2ZX\3\2\2\2[\\\7\24\2\2\\]\5\b\5\2]^\7\27"+ + "\2\2^_\7#\2\2_\7\3\2\2\2`b\t\2\2\2a`\3\2\2\2be\3\2\2\2ca\3\2\2\2cd\3\2"+ + "\2\2d\t\3\2\2\2ec\3\2\2\2fg\7\17\2\2gh\5B\"\2hi\7\r\2\2ij\7/\2\2jk\5\4"+ + "\3\2ku\7\60\2\2lm\7\20\2\2mn\5B\"\2no\7\r\2\2op\7/\2\2pq\5\4\3\2qr\7\60"+ + "\2\2rt\3\2\2\2sl\3\2\2\2tw\3\2\2\2us\3\2\2\2uv\3\2\2\2v}\3\2\2\2wu\3\2"+ + "\2\2xy\7\7\2\2yz\7/\2\2z{\5\4\3\2{|\7\60\2\2|~\3\2\2\2}x\3\2\2\2}~\3\2"+ + "\2\2~\13\3\2\2\2\177\u0080\7\n\2\2\u0080\u0081\5B\"\2\u0081\u0082\7\r"+ + "\2\2\u0082\u0083\7/\2\2\u0083\u0084\5\4\3\2\u0084\u0085\7\60\2\2\u0085"+ + "\r\3\2\2\2\u0086\u0094\5\20\t\2\u0087\u0094\5\22\n\2\u0088\u0094\5\24"+ + "\13\2\u0089\u0094\5\26\f\2\u008a\u0094\5\30\r\2\u008b\u0094\5\32\16\2"+ + "\u008c\u0094\5\34\17\2\u008d\u0094\5\36\20\2\u008e\u0094\5 \21\2\u008f"+ + "\u0094\5\"\22\2\u0090\u0094\5$\23\2\u0091\u0094\5&\24\2\u0092\u0094\5"+ + "(\25\2\u0093\u0086\3\2\2\2\u0093\u0087\3\2\2\2\u0093\u0088\3\2\2\2\u0093"+ + "\u0089\3\2\2\2\u0093\u008a\3\2\2\2\u0093\u008b\3\2\2\2\u0093\u008c\3\2"+ + "\2\2\u0093\u008d\3\2\2\2\u0093\u008e\3\2\2\2\u0093\u008f\3\2\2\2\u0093"+ + "\u0090\3\2\2\2\u0093\u0091\3\2\2\2\u0093\u0092\3\2\2\2\u0094\17\3\2\2"+ + "\2\u0095\u0096\7\3\2\2\u0096\21\3\2\2\2\u0097\u0098\7\22\2\2\u0098\23"+ + "\3\2\2\2\u0099\u009a\7\25\2\2\u009a\25\3\2\2\2\u009b\u009c\7\6\2\2\u009c"+ + "\27\3\2\2\2\u009d\u009e\7\t\2\2\u009e\31\3\2\2\2\u009f\u00a0\7\13\2\2"+ + "\u00a0\33\3\2\2\2\u00a1\u00a2\7\26\2\2\u00a2\35\3\2\2\2\u00a3\u00a4\7"+ + "\31\2\2\u00a4\37\3\2\2\2\u00a5\u00a6\7\4\2\2\u00a6!\3\2\2\2\u00a7\u00a8"+ + "\7\23\2\2\u00a8#\3\2\2\2\u00a9\u00aa\7\32\2\2\u00aa%\3\2\2\2\u00ab\u00ac"+ + "\7\33\2\2\u00ac\'\3\2\2\2\u00ad\u00ae\7\30\2\2\u00ae)\3\2\2\2\u00af\u00b0"+ + "\7\f\2\2\u00b0\u00b1\7\16\2\2\u00b1\u00b2\5D#\2\u00b2\u00b3\7\b\2\2\u00b3"+ + "\u00b4\5D#\2\u00b4\u00b5\7\b\2\2\u00b5\u00b6\5D#\2\u00b6\u00b7\7\b\2\2"+ + "\u00b7\u00b8\5D#\2\u00b8\u00b9\7\b\2\2\u00b9\u00ba\5D#\2\u00ba\u00bb\7"+ + "\5\2\2\u00bb+\3\2\2\2\u00bc\u00bd\7&\2\2\u00bd\u00be\7\"\2\2\u00be\u00bf"+ + "\5@!\2\u00bf\u00c0\7#\2\2\u00c0-\3\2\2\2\u00c1\u00c2\b\30\1\2\u00c2\u00c3"+ + "\5D#\2\u00c3\u00c9\3\2\2\2\u00c4\u00c5\6\30\2\3\u00c5\u00c6\7(\2\2\u00c6"+ + "\u00c8\5D#\2\u00c7\u00c4\3\2\2\2\u00c8\u00cb\3\2\2\2\u00c9\u00c7\3\2\2"+ + "\2\u00c9\u00ca\3\2\2\2\u00ca/\3\2\2\2\u00cb\u00c9\3\2\2\2\u00cc\u00cd"+ + "\b\31\1\2\u00cd\u00ce\5.\30\2\u00ce\u00d4\3\2\2\2\u00cf\u00d0\6\31\3\3"+ + "\u00d0\u00d1\7\'\2\2\u00d1\u00d3\5.\30\2\u00d2\u00cf\3\2\2\2\u00d3\u00d6"+ + "\3\2\2\2\u00d4\u00d2\3\2\2\2\u00d4\u00d5\3\2\2\2\u00d5\61\3\2\2\2\u00d6"+ + "\u00d4\3\2\2\2\u00d7\u00d8\b\32\1\2\u00d8\u00d9\5\60\31\2\u00d9\u00df"+ + "\3\2\2\2\u00da\u00db\6\32\4\3\u00db\u00dc\7)\2\2\u00dc\u00de\5\60\31\2"+ + "\u00dd\u00da\3\2\2\2\u00de\u00e1\3\2\2\2\u00df\u00dd\3\2\2\2\u00df\u00e0"+ + "\3\2\2\2\u00e0\63\3\2\2\2\u00e1\u00df\3\2\2\2\u00e2\u00e3\b\33\1\2\u00e3"+ + "\u00e4\5\62\32\2\u00e4\u00ea\3\2\2\2\u00e5\u00e6\6\33\5\3\u00e6\u00e7"+ + "\7*\2\2\u00e7\u00e9\5\62\32\2\u00e8\u00e5\3\2\2\2\u00e9\u00ec\3\2\2\2"+ + "\u00ea\u00e8\3\2\2\2\u00ea\u00eb\3\2\2\2\u00eb\65\3\2\2\2\u00ec\u00ea"+ + "\3\2\2\2\u00ed\u00ee\b\34\1\2\u00ee\u00ef\5\64\33\2\u00ef\u00f5\3\2\2"+ + "\2\u00f0\u00f1\6\34\6\3\u00f1\u00f2\7+\2\2\u00f2\u00f4\5\64\33\2\u00f3"+ + "\u00f0\3\2\2\2\u00f4\u00f7\3\2\2\2\u00f5\u00f3\3\2\2\2\u00f5\u00f6\3\2"+ + "\2\2\u00f6\67\3\2\2\2\u00f7\u00f5\3\2\2\2\u00f8\u00f9\b\35\1\2\u00f9\u00fa"+ + "\5\66\34\2\u00fa\u0100\3\2\2\2\u00fb\u00fc\6\35\7\3\u00fc\u00fd\7\36\2"+ + "\2\u00fd\u00ff\5\66\34\2\u00fe\u00fb\3\2\2\2\u00ff\u0102\3\2\2\2\u0100"+ + "\u00fe\3\2\2\2\u0100\u0101\3\2\2\2\u01019\3\2\2\2\u0102\u0100\3\2\2\2"+ + "\u0103\u0104\b\36\1\2\u0104\u0105\58\35\2\u0105\u010b\3\2\2\2\u0106\u0107"+ + "\6\36\b\3\u0107\u0108\7,\2\2\u0108\u010a\58\35\2\u0109\u0106\3\2\2\2\u010a"+ + "\u010d\3\2\2\2\u010b\u0109\3\2\2\2\u010b\u010c\3\2\2\2\u010c;\3\2\2\2"+ + "\u010d\u010b\3\2\2\2\u010e\u010f\b\37\1\2\u010f\u0110\5:\36\2\u0110\u0116"+ + "\3\2\2\2\u0111\u0112\6\37\t\3\u0112\u0113\7\37\2\2\u0113\u0115\5:\36\2"+ + "\u0114\u0111\3\2\2\2\u0115\u0118\3\2\2\2\u0116\u0114\3\2\2\2\u0116\u0117"+ + "\3\2\2\2\u0117=\3\2\2\2\u0118\u0116\3\2\2\2\u0119\u011a\b \1\2\u011a\u011b"+ + "\5<\37\2\u011b\u0121\3\2\2\2\u011c\u011d\6 \n\3\u011d\u011e\7 \2\2\u011e"+ + "\u0120\5<\37\2\u011f\u011c\3\2\2\2\u0120\u0123\3\2\2\2\u0121\u011f\3\2"+ + "\2\2\u0121\u0122\3\2\2\2\u0122?\3\2\2\2\u0123\u0121\3\2\2\2\u0124\u0125"+ + "\5> \2\u0125A\3\2\2\2\u0126\u0127\5@!\2\u0127C\3\2\2\2\u0128\u0137\7\34"+ + "\2\2\u0129\u0137\5F$\2\u012a\u0137\5J&\2\u012b\u0137\5\16\b\2\u012c\u012d"+ + "\7\16\2\2\u012d\u012e\5@!\2\u012e\u012f\7\5\2\2\u012f\u0137\3\2\2\2\u0130"+ + "\u0131\7!\2\2\u0131\u0132\7\16\2\2\u0132\u0133\5@!\2\u0133\u0134\7\5\2"+ + "\2\u0134\u0137\3\2\2\2\u0135\u0137\5*\26\2\u0136\u0128\3\2\2\2\u0136\u0129"+ + "\3\2\2\2\u0136\u012a\3\2\2\2\u0136\u012b\3\2\2\2\u0136\u012c\3\2\2\2\u0136"+ + "\u0130\3\2\2\2\u0136\u0135\3\2\2\2\u0137E\3\2\2\2\u0138\u0139\7.\2\2\u0139"+ + "G\3\2\2\2\u013a\u013b\7\21\2\2\u013b\u013c\7\16\2\2\u013c\u013d\7\34\2"+ + "\2\u013d\u013e\7\5\2\2\u013e\u013f\7#\2\2\u013fI\3\2\2\2\u0140\u0141\7"+ + "&\2\2\u0141K\3\2\2\2\22VXcu}\u0093\u00c9\u00d4\u00df\u00ea\u00f5\u0100"+ + "\u010b\u0116\u0121\u0136"; public static final ATN _ATN = ATNSimulator.deserialize(_serializedATN.toCharArray()); static { diff --git a/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentToAssemblyCompiler.java b/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentToAssemblyCompiler.java index 3256dff9..68e688ad 100644 --- a/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentToAssemblyCompiler.java +++ b/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentToAssemblyCompiler.java @@ -421,17 +421,18 @@ public class SerpentToAssemblyCompiler extends SerpentBaseVisitor { @Override public String visitAsm(@NotNull SerpentParser.AsmContext ctx) { - int size = ((SerpentParser.AsmContext) ctx).getChildCount(); + int size = ctx.asm_symbol().getChildCount(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < size ; ++i){ - String symbol = ((SerpentParser.AsmContext) ctx).getChild(i).toString(); + String symbol = ctx.asm_symbol().children.get(i).toString(); symbol = symbol.trim(); + // exclude all that is not an assembly code if (symbol.equals("[asm") || symbol.equals("asm]") || symbol.equals("\n")) continue; - boolean match = Pattern.matches("[0-9a-fA-F]+", symbol); + boolean match = Pattern.matches("[0-9]+", symbol); if (match){ int byteVal = Integer.parseInt(symbol); diff --git a/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentVisitor.java b/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentVisitor.java index 780873ae..7d5fe7d6 100644 --- a/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentVisitor.java +++ b/ethereumj-core/src/main/java/org/ethereum/serpent/SerpentVisitor.java @@ -53,6 +53,13 @@ public interface SerpentVisitor extends ParseTreeVisitor { */ T visitBlock(@NotNull SerpentParser.BlockContext ctx); + /** + * Visit a parse tree produced by {@link SerpentParser#asm_symbol}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAsm_symbol(@NotNull SerpentParser.Asm_symbolContext ctx); + /** * Visit a parse tree produced by {@link SerpentParser#tx_gas}. * @param ctx the parse tree @@ -123,13 +130,6 @@ public interface SerpentVisitor extends ParseTreeVisitor { */ T visitBlock_gaslimit(@NotNull SerpentParser.Block_gaslimitContext ctx); - /** - * Visit a parse tree produced by {@link SerpentParser#msg_func}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitMsg_func(@NotNull SerpentParser.Msg_funcContext ctx); - /** * Visit a parse tree produced by {@link SerpentParser#rel_exp}. * @param ctx the parse tree @@ -137,6 +137,13 @@ public interface SerpentVisitor extends ParseTreeVisitor { */ T visitRel_exp(@NotNull SerpentParser.Rel_expContext ctx); + /** + * Visit a parse tree produced by {@link SerpentParser#msg_func}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitMsg_func(@NotNull SerpentParser.Msg_funcContext ctx); + /** * Visit a parse tree produced by {@link SerpentParser#parse}. * @param ctx the parse tree