From: <jom...@us...> - 2013-10-19 19:37:19
|
Revision: 1751 http://sourceforge.net/p/jason/svn/1751 Author: jomifred Date: 2013-10-19 19:37:16 +0000 (Sat, 19 Oct 2013) Log Message: ----------- allows unicode chars in JacaCC input files Modified Paths: -------------- trunk/src/jason/asSyntax/parser/AS2JavaParser.jcc trunk/src/jason/asSyntax/parser/as2j.java trunk/src/jason/asSyntax/parser/as2jTokenManager.java trunk/src/jason/mas2j/parser/MAS2JavaParser.jcc trunk/src/jason/mas2j/parser/mas2jTokenManager.java trunk/src/jason/runtime/MASConsoleColorGUI.java trunk/src/jason/runtime/MASConsoleGUI.java Modified: trunk/src/jason/asSyntax/parser/AS2JavaParser.jcc =================================================================== --- trunk/src/jason/asSyntax/parser/AS2JavaParser.jcc 2013-10-04 14:35:08 UTC (rev 1750) +++ trunk/src/jason/asSyntax/parser/AS2JavaParser.jcc 2013-10-19 19:37:16 UTC (rev 1751) @@ -25,6 +25,7 @@ FORCE_LA_CHECK=true; STATIC=false; IGNORE_CASE=false; + UNICODE_INPUT=true; } PARSER_BEGIN(as2j) Modified: trunk/src/jason/asSyntax/parser/as2j.java =================================================================== --- trunk/src/jason/asSyntax/parser/as2j.java 2013-10-04 14:35:08 UTC (rev 1750) +++ trunk/src/jason/asSyntax/parser/as2j.java 2013-10-19 19:37:16 UTC (rev 1751) @@ -1524,11 +1524,6 @@ finally { jj_save(1, xla); } } - final private boolean jj_3R_54() { - if (jj_3R_61()) return true; - return false; - } - final private boolean jj_3R_67() { if (jj_3R_79()) return true; return false; @@ -2132,6 +2127,11 @@ return false; } + final private boolean jj_3R_54() { + if (jj_3R_61()) return true; + return false; + } + public as2jTokenManager token_source; SimpleCharStream jj_input_stream; public Token token, jj_nt; Modified: trunk/src/jason/asSyntax/parser/as2jTokenManager.java =================================================================== --- trunk/src/jason/asSyntax/parser/as2jTokenManager.java 2013-10-04 14:35:08 UTC (rev 1750) +++ trunk/src/jason/asSyntax/parser/as2jTokenManager.java 2013-10-19 19:37:16 UTC (rev 1751) @@ -364,6 +364,9 @@ jjCheckNAdd(jjnextStates[start + 1]); } static final long[] jjbitVec0 = { + 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec2 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; private final int jjMoveNfa_0(int startState, int curPos) @@ -729,6 +732,9 @@ } else { + int hiByte = (int)(curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); MatchLoop: do @@ -736,20 +742,20 @@ switch(jjstateSet[--i]) { case 1: - if ((jjbitVec0[i2] & l2) != 0L) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjAddStates(10, 12); break; case 15: - if ((jjbitVec0[i2] & l2) != 0L) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjAddStates(0, 2); break; case 20: - if ((jjbitVec0[i2] & l2) != 0L) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjCheckNAddTwoStates(20, 21); break; case 22: case 23: - if ((jjbitVec0[i2] & l2) != 0L) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjCheckNAddTwoStates(23, 21); break; default : break; @@ -773,6 +779,18 @@ 15, 16, 18, 36, 37, 38, 39, 40, 14, 19, 1, 2, 4, 1, 2, 6, 4, 21, 22, 24, 3, 5, 7, 30, 31, 41, 42, }; +private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec2[i2] & l2) != 0L); + default : + if ((jjbitVec0[i1] & l1) != 0L) + return true; + return false; + } +} public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, null, "\164\162\165\145", "\146\141\154\163\145", "\156\157\164", "\176", "\144\151\166", "\155\157\144", Modified: trunk/src/jason/mas2j/parser/MAS2JavaParser.jcc =================================================================== --- trunk/src/jason/mas2j/parser/MAS2JavaParser.jcc 2013-10-04 14:35:08 UTC (rev 1750) +++ trunk/src/jason/mas2j/parser/MAS2JavaParser.jcc 2013-10-19 19:37:16 UTC (rev 1751) @@ -24,6 +24,7 @@ options { STATIC=false; + UNICODE_INPUT=true; } PARSER_BEGIN(mas2j) Modified: trunk/src/jason/mas2j/parser/mas2jTokenManager.java =================================================================== --- trunk/src/jason/mas2j/parser/mas2jTokenManager.java 2013-10-04 14:35:08 UTC (rev 1750) +++ trunk/src/jason/mas2j/parser/mas2jTokenManager.java 2013-10-19 19:37:16 UTC (rev 1751) @@ -777,6 +777,9 @@ jjCheckNAdd(jjnextStates[start + 1]); } static final long[] jjbitVec0 = { + 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec2 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; private final int jjMoveNfa_0(int startState, int curPos) @@ -1529,6 +1532,9 @@ } else { + int hiByte = (int)(curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); MatchLoop: do @@ -1536,20 +1542,20 @@ switch(jjstateSet[--i]) { case 37: - if ((jjbitVec0[i2] & l2) != 0L) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjAddStates(7, 9); break; case 65: - if ((jjbitVec0[i2] & l2) != 0L) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjAddStates(14, 16); break; case 70: - if ((jjbitVec0[i2] & l2) != 0L) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjCheckNAddTwoStates(70, 71); break; case 72: case 73: - if ((jjbitVec0[i2] & l2) != 0L) + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjCheckNAddTwoStates(73, 71); break; default : break; @@ -1573,6 +1579,18 @@ 82, 83, 31, 84, 85, 64, 69, 37, 38, 40, 37, 38, 42, 40, 65, 66, 68, 71, 72, 74, 78, 79, 80, 56, 62, 34, 35, 39, 41, 43, 86, 87, }; +private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec2[i2] & l2) != 0L); + default : + if ((jjbitVec0[i1] & l1) != 0L) + return true; + return false; + } +} public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, "\115\101\123", "\141\147\145\156\164\163", "\145\156\166\151\162\157\156\155\145\156\164", Modified: trunk/src/jason/runtime/MASConsoleColorGUI.java =================================================================== --- trunk/src/jason/runtime/MASConsoleColorGUI.java 2013-10-04 14:35:08 UTC (rev 1750) +++ trunk/src/jason/runtime/MASConsoleColorGUI.java 2013-10-19 19:37:16 UTC (rev 1751) @@ -10,6 +10,7 @@ import javax.swing.JTextPane; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; +import javax.swing.text.DefaultCaret; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; @@ -45,6 +46,7 @@ protected void initOutput() { output = new MASColorTextPane(Color.black); output.setEditable(false); + ((DefaultCaret)output.getCaret()).setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); if (isTabbed()) { tabPane.add("common", new JScrollPane(output)); } else { @@ -83,10 +85,8 @@ int l = ta.getDocument().getLength(); if (l > 100000) { ta.setText(""); - // l = output.getDocument().getLength(); } ta.append(s); - // output.setCaretPosition(l); } } @@ -98,6 +98,7 @@ } synchronized (this) { output.append(c, s); + output.setCaretPosition(l); } } catch (Exception e) { close(); Modified: trunk/src/jason/runtime/MASConsoleGUI.java =================================================================== --- trunk/src/jason/runtime/MASConsoleGUI.java 2013-10-04 14:35:08 UTC (rev 1750) +++ trunk/src/jason/runtime/MASConsoleGUI.java 2013-10-19 19:37:16 UTC (rev 1751) @@ -43,6 +43,7 @@ import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTextArea; +import javax.swing.text.DefaultCaret; /** the GUI console to output log messages */ public class MASConsoleGUI { @@ -109,6 +110,7 @@ protected void initOutput() { output = new JTextArea(); output.setEditable(false); + ((DefaultCaret)output.getCaret()).setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); if (isTabbed) { tabPane.add("common", new JScrollPane(output)); } else { @@ -195,10 +197,8 @@ int l = ta.getDocument().getLength(); if (l > 100000) { ta.setText(""); - // l = output.getDocument().getLength(); } ta.append(s); - // output.setCaretPosition(l); } } @@ -210,6 +210,7 @@ } synchronized (this) { output.append(s); + output.setCaretPosition(l); } } catch (Exception e) { close(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |