From b791c331d6a34065d5895cdf74bed6efabbf23a9 Mon Sep 17 00:00:00 2001 From: Adeel Asghar Date: Wed, 6 Apr 2016 05:51:28 +0200 Subject: [PATCH] Removed unused OMC parser. --- .../OMEditGUI/Debugger/Parser/Makefile.common | 3 +- .../Debugger/Parser/Makefile.lib.common | 17 +-- OMEdit/OMEditGUI/OMC/OMCProxy.cpp | 25 ---- OMEdit/OMEditGUI/OMC/Parser/OMCOutput.g | 123 ------------------ OMEdit/OMEditGUI/OMEditGUI.pro | 8 +- 5 files changed, 5 insertions(+), 171 deletions(-) delete mode 100644 OMEdit/OMEditGUI/OMC/Parser/OMCOutput.g diff --git a/OMEdit/OMEditGUI/Debugger/Parser/Makefile.common b/OMEdit/OMEditGUI/Debugger/Parser/Makefile.common index 636ee355760..66183847f99 100644 --- a/OMEdit/OMEditGUI/Debugger/Parser/Makefile.common +++ b/OMEdit/OMEditGUI/Debugger/Parser/Makefile.common @@ -12,9 +12,8 @@ libantlr3.a: $(ANTLR)/src/*.c $(ANTLR)/include/*.h $(ANTLR)/antlr3config.h ranlib libantlr3.a rm -f antlr3*.o -parsergen: GDBMIOutput.g ../../OMC/Parser/OMCParser.g +parsergen: GDBMIOutput.g $(ANTLRCMD) GDBMIOutput.g - (cd ../../OMC/Parser/ && $(ANTLRCMD) OMCParser.g) OBJS = GDBMIOutputLexer.o \ GDBMIOutputParser.o \ diff --git a/OMEdit/OMEditGUI/Debugger/Parser/Makefile.lib.common b/OMEdit/OMEditGUI/Debugger/Parser/Makefile.lib.common index cb31f63a973..4fb5fa65c02 100644 --- a/OMEdit/OMEditGUI/Debugger/Parser/Makefile.lib.common +++ b/OMEdit/OMEditGUI/Debugger/Parser/Makefile.lib.common @@ -1,5 +1,5 @@ ANTLRCMD=java -cp $(ANTLRJAR) org.antlr.Tool -Xconversiontimeout 10000 -report -PARSERGEN=GDBMIOutputLexer.c GDBMIOutputLexer.h GDBMIOutputParser.c GDBMIOutputParser.h ../../OMC/Parser/OMCOutputLexer.cpp ../../OMC/Parser/OMCOutputLexer.h ../../OMC/Parser/OMCOutputParser.cpp ../../OMC/Parser/OMCOutputParser.h +PARSERGEN=GDBMIOutputLexer.c GDBMIOutputLexer.h GDBMIOutputParser.c GDBMIOutputParser.h all: $(PARSERGEN) libGDBMIParser.a @@ -9,17 +9,6 @@ GDBMIOutputParser.h: GDBMIOutputLexer.c GDBMIOutputLexer.c: GDBMIOutput.g $(ANTLRCMD) $< -../../OMC/Parser/OMCOutputLexer.cpp: ../../OMC/Parser/OMCOutputLexer.c - cp $< $@ -../../OMC/Parser/OMCOutputParser.cpp: ../../OMC/Parser/OMCOutputParser.c - cp $< $@ - -../../OMC/Parser/OMCOutputLexer.c: ../../OMC/Parser/OMCOutputLexer.h -../../OMC/Parser/OMCOutputLexer.h: ../../OMC/Parser/OMCOutputParser.h -../../OMC/Parser/OMCOutputParser.h: ../../OMC/Parser/OMCOutputParser.c -../../OMC/Parser/OMCOutputParser.c: ../../OMC/Parser/OMCOutput.g - (cd ../../OMC/Parser/ && $(ANTLRCMD) OMCOutput.g) - OBJS = GDBMIOutputLexer.o \ GDBMIOutputParser.o \ GDBMIParser.o @@ -44,6 +33,4 @@ clean: rm -f *.o *.a \ GDBMIOutput.tokens \ GDBMIOutputLexer.c GDBMIOutputLexer.h \ - GDBMIOutputParser.c GDBMIOutputParser.h \ - ../../OMC/Parser/OMCOutput.tokens \ - ../../OMC/Parser/OMCOutput*.c* ../../OMC/Parser/OMCOutput*.h ../../OMC/Parser/*.o + GDBMIOutputParser.c GDBMIOutputParser.h diff --git a/OMEdit/OMEditGUI/OMC/OMCProxy.cpp b/OMEdit/OMEditGUI/OMC/OMCProxy.cpp index 2bf6d2f47a8..52bd4e25221 100644 --- a/OMEdit/OMEditGUI/OMC/OMCProxy.cpp +++ b/OMEdit/OMEditGUI/OMC/OMCProxy.cpp @@ -35,8 +35,6 @@ * */ -#include -#include #include "meta/meta_modelica.h" #ifdef WIN32 #include "version.h" @@ -62,29 +60,6 @@ void omc_Main_setWindowsPaths(threadData_t *threadData, void* _inOMHome); #include "simulation_options.h" #include "omc_error.h" -static QVariant parseExpression(QString result) -{ - QVariant res; - pANTLR3_INPUT_STREAM input; - pOMCOutputLexer lex; - pANTLR3_COMMON_TOKEN_STREAM tokens; - pOMCOutputParser parser; - QByteArray ba = result.toUtf8(); - - input = antlr3NewAsciiStringInPlaceStream((pANTLR3_UINT8)ba.data(), ba.size(), (pANTLR3_UINT8)""); - lex = OMCOutputLexerNew(input); - tokens = antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT, TOKENSOURCE(lex)); - parser = OMCOutputParserNew(tokens); - - parser->exp(parser, res); - // Clean up? Check error? For chickens - parser->free(parser); - tokens->free(tokens); - lex->free(lex); - input->close(input); - return res; -} - /*! \class OMCProxy \brief It contains the reference of the CORBA object used to communicate with the OpenModelica Compiler. diff --git a/OMEdit/OMEditGUI/OMC/Parser/OMCOutput.g b/OMEdit/OMEditGUI/OMC/Parser/OMCOutput.g deleted file mode 100644 index 04f272c4b2d..00000000000 --- a/OMEdit/OMEditGUI/OMC/Parser/OMCOutput.g +++ /dev/null @@ -1,123 +0,0 @@ -/* - * This file is part of OpenModelica. - * - * Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC), - * c/o Linkopings universitet, Department of Computer and Information Science, - * SE-58183 Linkoping, Sweden. - * - * All rights reserved. - * - * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR - * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2. - * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE - * OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, ACCORDING TO RECIPIENTS CHOICE. - * - * The OpenModelica software and the Open Source Modelica - * Consortium (OSMC) Public License (OSMC-PL) are obtained - * from OSMC, either from the above address, - * from the URLs: http://www.ida.liu.se/projects/OpenModelica or - * http://www.openmodelica.org, and in the OpenModelica distribution. - * GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html. - * - * This program is distributed WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH - * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL. - * - * See the full OSMC Public License conditions for more details. - * - */ -/* - * - * @author sjoelund.se - * - * Based on OMC Values.Value output syntax - */ - -grammar OMCOutput; - -options { - ASTLabelType = pANTLR3_BASE_TREE; - language = C; -} - -@includes { -#include -} - -exp [QVariant &res] -@init { - QVariantList res2; -} - : T_INTEGER {res = QVariant::fromValue((long) QString((char*)$T_INTEGER.text->chars).toLong());} - | T_REAL {res = QVariant(QString((char*)$T_REAL.text->chars).toDouble());} - | T_MODELICA_STRING {res = QVariant(QString((char*)$T_MODELICA_STRING.text->chars));} - | T_IDENT {res = QVariant(QString((char*)$T_IDENT.text->chars));} - | T_TRUE {res = QVariant(true);} - | T_FALSE {res = QVariant(false);} - | T_FAIL {res = QVariant();} - | T_LPAR T_RPAR {res = QVariantList();} - | T_LPAR {res2 = QVariantList();} exp_list[res2] {res = res2;} - ; - -exp_list [QVariantList &lst] -@init { - QVariant res; -} - : exp[res] (T_COMMA exp_list[lst] | T_RPAR) {lst.push_front(res);} - ; - -// LEXER - -T_LPAR : '(' | '{'; -T_RPAR : ')' | '}'; -T_FAIL : 'fail()'; - -T_TRUE : 'true'; -T_FALSE : 'false'; - -T_MODELICA_STRING : '"' ('\\"' | ~'"')* '"'; - -T_IDENT : QIDENT | IDENT2; -T_COMMA : ','; - -fragment -IDENT2 : NONDIGIT (NONDIGIT | DIGIT)*; - -fragment -QIDENT : - '\'' (QCHAR | SESCAPE) (QCHAR | SESCAPE)* '\'' ; - -fragment -QCHAR : (DIGIT | NONDIGIT | '!' | '#' | '$' | '%' | '&' | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '>' | '=' | '?' | '@' | '[' | ']' | '^' | -'{' | '}' | '|' | '~' | ' '); - -fragment -SESCAPE : esc='\\' ('\\' | '"' | '\'' | '?' | 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v'); - -fragment -NONDIGIT : ('_' | 'a'..'z' | 'A'..'Z'); - -fragment -DIGIT : - '0'..'9' - ; - -WS : - (' ' | '\t' | '\n') { $channel=HIDDEN; } - ; - -fragment -EXPONENT : - ('e'|'E') ('+' | '-')? (DIGIT)+ - ; - - -T_INTEGER : '-'? (DIGIT)+; -T_REAL : - '-'? - ( - ((DIGIT)+ '.' (DIGIT)*|(DIGIT)* '.' (DIGIT)+) EXPONENT? - | (DIGIT)+ EXPONENT - ) - ; diff --git a/OMEdit/OMEditGUI/OMEditGUI.pro b/OMEdit/OMEditGUI/OMEditGUI.pro index 1a2e7be9415..9a9136727ed 100644 --- a/OMEdit/OMEditGUI/OMEditGUI.pro +++ b/OMEdit/OMEditGUI/OMEditGUI.pro @@ -155,9 +155,7 @@ SOURCES += main.cpp \ Debugger/Attach/AttachToProcessDialog.cpp \ Debugger/Attach/ProcessListModel.cpp \ CrashReport/backtrace.c \ - CrashReport/CrashReportDialog.cpp \ - OMC/Parser/OMCOutputParser.cpp \ - OMC/Parser/OMCOutputLexer.cpp + CrashReport/CrashReportDialog.cpp HEADERS += Util/Helper.h \ Util/Utilities.h \ @@ -222,9 +220,7 @@ HEADERS += Util/Helper.h \ Debugger/Attach/AttachToProcessDialog.h \ Debugger/Attach/ProcessListModel.h \ CrashReport/backtrace.h \ - CrashReport/CrashReportDialog.h \ - OMC/Parser/OMCOutputParser.h \ - OMC/Parser/OMCOutputLexer.h + CrashReport/CrashReportDialog.h LIBS += -lqjson INCLUDEPATH += ../../qjson/build/include