-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* skip trivial first tokens in parsing * remove comment in input test * manage out-of-bound case, update input test * update input test * update input test * make test programs private * remove comments in syntax tests * format * make Pragma optional, remove ROOT * rename close() params, use advance() in eat(), fix typo scope * parse params using list_identity * return Option in token_value() and position_of() * do not allow <--, <== in var declaration * make public signal optional in main component * fix format before merge
- Loading branch information
Showing
15 changed files
with
452 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
use crate::grammar::*; | ||
|
||
// fucntion name() | ||
pub fn function_parse(p: &mut Parser) { | ||
let m = p.open(); | ||
|
||
p.expect(FunctionKw); | ||
let fn_name_marker = p.open(); | ||
|
||
let fn_name_marker = p.open(); | ||
p.expect(Identifier); | ||
p.close(fn_name_marker, FunctionName); | ||
|
||
p.expect(LParen); | ||
let arg_marker = p.open(); | ||
while !p.at(RParen) && !p.eof() { | ||
p.expect(Identifier); | ||
if p.at(Comma) { | ||
p.expect(Comma); | ||
} | ||
} | ||
|
||
list_identity::parse(p); | ||
p.close(arg_marker, ParameterList); | ||
|
||
p.expect(RParen); | ||
|
||
block::block(p); | ||
|
||
p.close(m, FunctionDef); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
use super::*; | ||
|
||
/* | ||
component main {public [signal_list]} = tempid(v1,...,vn); | ||
{public [signal_list]} is optional | ||
*/ | ||
pub fn main_component(p: &mut Parser) { | ||
p.expect(ComponentKw); | ||
p.expect(MainKw); | ||
p.expect(LCurly); | ||
p.expect(PublicKw); | ||
p.expect(LBracket); | ||
list_identity::parse(p); | ||
p.expect(RBracket); | ||
|
||
if p.at(LCurly) { | ||
p.expect(LCurly); | ||
p.expect(PublicKw); | ||
p.expect(LBracket); | ||
list_identity::parse(p); | ||
p.expect(RBracket); | ||
} | ||
|
||
p.expect(Assign); | ||
expression::expression(p); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.