diff options
author | johnvg | 2001-12-05 12:25:52 +0000 |
---|---|---|
committer | johnvg | 2001-12-05 12:25:52 +0000 |
commit | 55e593fde5249c7216729d7e21a9dcab47362874 (patch) | |
tree | bcdf53e941d97afaec79d2e3991e4f21e134b027 /frontend/parse.icl | |
parent | forgot to some definitions to export (diff) |
removed type from BasicExpr
added BVInt
removed symb_arity from SymbIdent
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@918 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/parse.icl')
-rw-r--r-- | frontend/parse.icl | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/frontend/parse.icl b/frontend/parse.icl index 8e0aa74..f81991b 100644 --- a/frontend/parse.icl +++ b/frontend/parse.icl @@ -2282,8 +2282,38 @@ where trySimpleExpressionT CurlyOpenToken is_pattern pState # (rec_or_aray_exp, pState) = wantRecordOrArrayExp is_pattern pState = (True, rec_or_aray_exp, pState) -trySimpleExpressionT (IntToken int) is_pattern pState - = (True, PE_Basic (BVI int), pState) +trySimpleExpressionT (IntToken int_string) is_pattern pState + # (ok,int) = string_to_int int_string + with + string_to_int s + | len==0 + = (False,0) + | s.[0] == '-' + | len>2 && s.[1]=='0' /* octal */ + = (False,0) + # (ok,int) = (string_to_int2 1 0 s) + = (ok,~int) + | s.[0] == '+' + | len>2&& s.[1]=='0' /* octal */ + = (False,0) + = string_to_int2 1 0 s + | s.[0]=='0' && len>1 /* octal */ + = (False,0) + = string_to_int2 0 0 s + where + len = size s + + string_to_int2:: !Int !Int !{#Char} -> (!Bool,!Int) + string_to_int2 posn val s + | len==posn + = (True,val) + # n = toInt (s.[posn]) - toInt '0' + | 0<=n && n<= 9 + = string_to_int2 (posn+1) (n+val*10) s + = (False,0) + | ok + = (True, PE_Basic (BVInt int), pState) + = (True, PE_Basic (BVI int_string), pState) trySimpleExpressionT (StringToken string) is_pattern pState = (True, PE_Basic (BVS string), pState) trySimpleExpressionT (BoolToken bool) is_pattern pState |