feat: add managed types, source classes and scoped native calls
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use crate::ast::{
|
||||
Assignment, AstRoot, BinaryOp, Binding, Block, Decl, DeclKind, Expr, ExprKind, Function,
|
||||
InteractiveInput, Name, Parameter, Program, ReturnStatement, Stmt, StmtKind, UnaryOp,
|
||||
Assignment, AstRoot, BinaryOp, Binding, Block, Class, Decl, DeclKind, Expr, ExprKind, Function,
|
||||
InteractiveInput, MemberAssignment, Name, Parameter, Program, ReturnStatement, Stmt, StmtKind,
|
||||
UnaryOp,
|
||||
};
|
||||
use crate::lexer::decode_string;
|
||||
use crate::{Diagnostic, DiagnosticKind, Span, Token, TokenKind, lex};
|
||||
@@ -44,7 +45,7 @@ pub fn parse_source_expression(
|
||||
parse_expression(source.text()).map_err(|error| source.annotate(error))
|
||||
}
|
||||
|
||||
/// Parse one or more basic typed function declarations. This is a syntax
|
||||
/// Parse one or more typed function or class declarations. This is a syntax
|
||||
/// operation: type names and name references are retained without resolution.
|
||||
pub fn parse(source: &str) -> Result<Program, Diagnostic> {
|
||||
let tokens = lex(source)?;
|
||||
@@ -93,6 +94,11 @@ enum Suffix {
|
||||
Call(Vec<Expr>, Span),
|
||||
}
|
||||
|
||||
enum ClassMember {
|
||||
Field(Parameter),
|
||||
Method(Function),
|
||||
}
|
||||
|
||||
fn postfix(expression: Expr, suffix: Suffix) -> Expr {
|
||||
match suffix {
|
||||
Suffix::Member(name) => Expr {
|
||||
|
||||
Reference in New Issue
Block a user