QlowB 6 gadi atpakaļ
vecāks
revīzija
a5d553813d
2 mainītis faili ar 28 papildinājumiem un 1 dzēšanām
  1. 10 1
      src/Ast.h
  2. 18 0
      src/parser.y

+ 10 - 1
src/Ast.h

@@ -213,12 +213,21 @@ struct qlow::ast::MethodDefinition : public FeatureDeclaration
         body{ std::move(body) }
     {
     }
+    
+    
+    inline MethodDefinition(std::unique_ptr<ast::Type> type, const std::string& name,
+            OwningList<ArgumentDeclaration>&& arguments, std::unique_ptr<DoEndBlock> body, const CodePosition& cp) :
+        FeatureDeclaration{ std::move(type), name, cp },
+        arguments(std::move(arguments)),
+        body{ std::move(body) }
+    {
+    }
 
     virtual std::unique_ptr<sem::SemanticObject> accept(StructureVisitor& v, sem::Scope&);
 };
 
 
-struct qlow::ast::VariableDeclaration  : public AstObject
+struct qlow::ast::VariableDeclaration : public AstObject
 {
     std::unique_ptr<ast::Type> type;
     std::string name;

+ 18 - 0
src/parser.y

@@ -274,6 +274,24 @@ fieldDeclaration:
     };
 
 
+externMethodDeclaration:
+    EXTERN IDENTIFIER COLON type {
+    
+    }
+    |
+    EXTERN IDENTIFIER {
+    
+    }
+    |
+    EXTERN IDENTIFIER ROUND_LEFT argumentList ROUND_RIGHT {
+    
+    }
+    |
+    EXTERN IDENTIFIER ROUND_LEFT argumentList ROUND_RIGHT COLON type {
+    
+    };
+    
+
 methodDefinition:
     IDENTIFIER COLON type doEndBlock {
         $$ = new MethodDefinition(std::unique_ptr<qlow::ast::Type>($3), *$1, std::unique_ptr<DoEndBlock>($4), @$);