From: lempinen Date: Fri, 22 Oct 2010 13:01:33 +0000 (+0000) Subject: Table support for []-brackets X-Git-Tag: simantics-1.2.1~10 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=f535abc4b9cd56f5b097a594fd16d6eb27b92cd8;p=simantics%2Fsysdyn.git Table support for []-brackets git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@18508 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java index fdb2894b..5a64a01e 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2010 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ /* Generated By:JavaCC: Do not edit this line. ExpressionParser.java */ package org.simantics.sysdyn.expressionParser; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserConstants.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserConstants.java index 8af22486..9f7b09b1 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserConstants.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserConstants.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2010 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ /* Generated By:JavaCC: Do not edit this line. ExpressionParserConstants.java */ package org.simantics.sysdyn.expressionParser; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserTokenManager.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserTokenManager.java index 2ca8a9d6..89a1a1d7 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserTokenManager.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserTokenManager.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2010 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ /* Generated By:JavaCC: Do not edit this line. ExpressionParserTokenManager.java */ package org.simantics.sysdyn.expressionParser; import java.util.Set; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/ParseException.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/ParseException.java index 7a1085d8..57f889b6 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/ParseException.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/ParseException.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2010 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ /* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ /* JavaCCOptions:KEEP_LINE_COL=null */ package org.simantics.sysdyn.tableParser; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/SimpleCharStream.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/SimpleCharStream.java index 0915e7c2..70ba9d99 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/SimpleCharStream.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/SimpleCharStream.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2010 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ /* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ /* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.simantics.sysdyn.tableParser; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/TableParser.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/TableParser.java index 174d0870..a8f1dd22 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/TableParser.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/TableParser.java @@ -19,22 +19,19 @@ public class TableParser implements TableParserConstants { final public void table() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 64: - jj_consume_token(64); - table_element(); - label_1: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 71: - ; - break; - default: - jj_la1[0] = jj_gen; - break label_1; - } - jj_consume_token(71); - table_element(); + case 66: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 64: + curlyTable(); + break; + case 66: + bracketTable(); + break; + default: + jj_la1[0] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } - jj_consume_token(65); break; default: jj_la1[1] = jj_gen; @@ -43,12 +40,52 @@ public class TableParser implements TableParserConstants { jj_consume_token(0); } - final public void table_element() throws ParseException { + final public void curlyTable() throws ParseException { + jj_consume_token(64); jj_consume_token(64); + table_element(); + jj_consume_token(65); + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[2] = jj_gen; + break label_1; + } + jj_consume_token(71); + jj_consume_token(64); + table_element(); + jj_consume_token(65); + } + jj_consume_token(65); + } + + final public void bracketTable() throws ParseException { + jj_consume_token(66); + table_element(); + label_2: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 70: + ; + break; + default: + jj_la1[3] = jj_gen; + break label_2; + } + jj_consume_token(70); + table_element(); + } + jj_consume_token(67); + } + + final public void table_element() throws ParseException { x_value(); jj_consume_token(71); y_value(); - jj_consume_token(65); } final public void x_value() throws ParseException { @@ -73,7 +110,7 @@ public class TableParser implements TableParserConstants { jj_consume_token(SIGNED_NUMBER); break; default: - jj_la1[2] = jj_gen; + jj_la1[4] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -88,7 +125,7 @@ public class TableParser implements TableParserConstants { public Token jj_nt; private int jj_ntk; private int jj_gen; - final private int[] jj_la1 = new int[3]; + final private int[] jj_la1 = new int[5]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; @@ -98,13 +135,13 @@ public class TableParser implements TableParserConstants { jj_la1_init_2(); } private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x0,0x0,0x0,}; + jj_la1_0 = new int[] {0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,}; + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x80,0x1,0x70000000,}; + jj_la1_2 = new int[] {0x5,0x5,0x80,0x40,0x70000000,}; } /** Constructor with InputStream. */ @@ -118,7 +155,7 @@ public class TableParser implements TableParserConstants { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 3; i++) jj_la1[i] = -1; + for (int i = 0; i < 5; i++) jj_la1[i] = -1; } /** Reinitialise. */ @@ -132,7 +169,7 @@ public class TableParser implements TableParserConstants { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 3; i++) jj_la1[i] = -1; + for (int i = 0; i < 5; i++) jj_la1[i] = -1; } /** Constructor. */ @@ -142,7 +179,7 @@ public class TableParser implements TableParserConstants { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 3; i++) jj_la1[i] = -1; + for (int i = 0; i < 5; i++) jj_la1[i] = -1; } /** Reinitialise. */ @@ -152,7 +189,7 @@ public class TableParser implements TableParserConstants { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 3; i++) jj_la1[i] = -1; + for (int i = 0; i < 5; i++) jj_la1[i] = -1; } /** Constructor with generated Token Manager. */ @@ -161,7 +198,7 @@ public class TableParser implements TableParserConstants { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 3; i++) jj_la1[i] = -1; + for (int i = 0; i < 5; i++) jj_la1[i] = -1; } /** Reinitialise. */ @@ -170,7 +207,7 @@ public class TableParser implements TableParserConstants { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 3; i++) jj_la1[i] = -1; + for (int i = 0; i < 5; i++) jj_la1[i] = -1; } private Token jj_consume_token(int kind) throws ParseException { @@ -226,7 +263,7 @@ public class TableParser implements TableParserConstants { la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 3; i++) { + for (int i = 0; i < 5; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1< + ( curlyTable() | bracketTable())? } +void curlyTable() : { } { + ( "{" "{" table_element() "}" ( "," "{" table_element() "}" )* "}" ) +} +void bracketTable() : { } { + ( "[" table_element() ( ";" table_element() )* "]" ) +} + void table_element() : { } { - "{" x_value() "," y_value() "}" + (x_value() "," y_value()) } void x_value() : { diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/Token.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/Token.java index 599df35d..e5636f30 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/Token.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/Token.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2010 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ /* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.simantics.sysdyn.tableParser; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/TokenMgrError.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/TokenMgrError.java index d96d9779..49dbdbf9 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/TokenMgrError.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/TokenMgrError.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2010 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ /* JavaCCOptions: */ package org.simantics.sysdyn.tableParser;