diff options
author | dos-reis <gdr@axiomatics.org> | 2008-04-19 04:36:36 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-04-19 04:36:36 +0000 |
commit | 20b621ddcdf7dcd0c730ff5fc4a446ea1f829951 (patch) | |
tree | 24e6cbe431a2f46020c21857473fe0ad8e34ed1e /src/boot/parser.boot | |
parent | 35ef2226d840fbc726f944afd053abd56fa0ee75 (diff) | |
download | open-axiom-20b621ddcdf7dcd0c730ff5fc4a446ea1f829951.tar.gz |
* boot/ast.boot (%DefaultValue): New %Ast node.
(bfParameterList): New.
(bfInsertLet): Use it.
(bfInsertLet1): Handle parameter with default values.
* boot/parser.boot (bpRegularBVItemTail): Split from bpRegularBVItem.
(bpRegularBVItem): Tidy.
Diffstat (limited to 'src/boot/parser.boot')
-rw-r--r-- | src/boot/parser.boot | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/boot/parser.boot b/src/boot/parser.boot index 6eeaa392..af8098b2 100644 --- a/src/boot/parser.boot +++ b/src/boot/parser.boot @@ -981,17 +981,28 @@ bpPatternTail()== and bpPush append (bpPop2(),bpPop1()) or true) -- BOUND VARIABLE + +++ We are parsing parameters in a function definition. We have +++ just seen a parameter name; we are attempting to see whether +++ it might be followed by a type annotation, or whether it actually +++ a form with a specific pattern structure, or whether it has +++ a default value. +bpRegularBVItemTail() == + bpEqKey "COLON" and (bpApplication() or bpTrap()) and + bpPush bfTagged(bpPop2(), bpPop1()) + or bpEqKey "BEC" and (bpPattern() or bpTrap()) and + bpPush bfAssign(bpPop2(),bpPop1()) + or bpEqKey "IS" and (bpPattern() or bpTrap()) and + bpPush bfAssign(bpPop2(),bpPop1()) + or bpEqKey "DEF" and (bpApplication() or bpTrap()) and + bpPush %DefaultValue(bpPop2(), bpPop1()) + + bpRegularBVItem() == - bpBVString() or - bpConstTok() or - (bpName() and - (bpEqKey "COLON" and (bpApplication() or bpTrap()) - and bpPush bfTagged(bpPop2(), bpPop1()) or - bpEqKey "BEC" and (bpPattern() or bpTrap()) - and bpPush bfAssign(bpPop2(),bpPop1()) or - (bpEqKey "IS" and (bpPattern() or bpTrap()) - and bpPush bfAssign(bpPop2(),bpPop1())) or true)) - or bpBracketConstruct function bpPatternL + bpBVString() + or bpConstTok() + or (bpName() and (bpRegularBVItemTail() or true)) + or bpBracketConstruct function bpPatternL bpBVString()== EQ(shoeTokType $stok,"STRING") and |