Changeset 13577


Ignore:
Timestamp:
Sep 23, 2019 5:30:54 PM (3 months ago)
Author:
mjohnsson
Message:

#5847 basic support for SrcFunctionCall lists.

Location:
branches/dev-mj-5847/Compiler
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-mj-5847/Compiler/ModelicaFrontEnd/src/jastadd/ast/Modelica.ast

    r13354 r13577  
    277277SrcWhileStmt           : SrcStatement ::= Test:SrcExp SrcWhileStmt:SrcStatement*;
    278278
     279SrcFunctionCallList    ::= ConvertRules:SrcFunctionCall*;
     280
    279281SrcParExp    : SrcExp ::= SrcExp;
    280282SrcIfExp     : SrcExp ::= SrcIfExp:SrcExp ThenExp:SrcExp ElseExp:SrcExp;
  • branches/dev-mj-5847/Compiler/ModelicaFrontEnd/src/jastadd/source/Parser.jrag

    r13404 r13577  
    181181    }
    182182
     183    public short ParserHandler.functionCallListGoal() {
     184        return org.jmodelica.modelica.parser.ModelicaParser.AltGoals.function_call_list;
     185    }
     186
    183187    public SourceRoot ParserHandler.parseFile(UtilInterface uif, LoadInfo loadInfo)
    184188            throws ParserException, beaver.Parser.Exception, FileNotFoundException, IOException {
     
    289293        }
    290294        return elem;
     295    }
     296
     297    private SrcFunctionCallList ParserHandler.parseFunctionCallList(Reader r, Path path)
     298            throws ParserException, beaver.Parser.Exception, IOException {
     299        LoadInfo fileloadInfo = LoadInfo.create(path);
     300        AbstractModelicaScanner<ASTNode<?>> scanner = createModelicaScanner(r);
     301        beaver.Parser parser = createModelicaParser(scanner, fileloadInfo);
     302        SrcFunctionCallList elem = (SrcFunctionCallList) parser.parse(scanner, functionCallListGoal());
     303        scanner.getFormattingRecorder().postParsing(elem);
     304        return elem;
     305    }
     306   
     307    public SrcFunctionCallList ParserHandler.parseFunctionCallList(String code, Path path)
     308            throws ParserException, beaver.Parser.Exception, IOException {
     309        return parseFunctionCallList(new StringReader(code), path);
     310    }
     311   
     312    public SrcFunctionCallList ParserHandler.parseFunctionCallList(Path path)
     313            throws ParserException, beaver.Parser.Exception, IOException {
     314        return parseFunctionCallList(fileReader(null, path.toFile()), path);
    291315    }
    292316
  • branches/dev-mj-5847/Compiler/ModelicaFrontEnd/src/parser/Modelica.parser

    r13404 r13577  
    2323%goal access_scalar;
    2424%goal subscript;
     25%typeof function_call_list = "SrcFunctionCallList";
     26%goal function_call_list;
    2527
    2628%header {:
     
    15171519  ;
    15181520
     1521List function_calls =
     1522    function_call SEMICOLON                       {: return new List().add(function_call); :}
     1523  | function_call SEMICOLON function_calls {: return function_calls.add(function_call); :}
     1524  ;
     1525
     1526SrcFunctionCallList function_call_list
     1527    = function_calls
     1528    {:
     1529        return new SrcFunctionCallList(function_calls);
     1530    :}
     1531
    15191532SrcFunctionCall function_call
    15201533    = access
  • branches/dev-mj-5847/Compiler/ModelicaFrontEnd/src/parser/Modelica_header.beaver

    r5961 r13577  
    2323%left MULT, DIV;
    2424%left PLUS, MINUS;
    25 
  • branches/dev-mj-5847/Compiler/OptimicaFrontEnd/src/jastadd/OptimicaParser.jrag

    r13409 r13577  
    6868        return org.jmodelica.optimica.parser.ModelicaParser.AltGoals.subscript;
    6969    }
     70   
     71    refine Parsers public short ParserHandler.functionCallListGoal() {
     72        return org.jmodelica.modelica.parser.ModelicaParser.AltGoals.function_call_list;
     73    }
     74
    7075
    7176    public beaver.Parser ParserHandler.createOptimicaParser(AbstractModelicaScanner<ASTNode<?>> scanner, LoadInfo loadInfo) {
Note: See TracChangeset for help on using the changeset viewer.