Corrected a bad ai choice
svn: r7321
This commit is contained in:
parent
dec670ff75
commit
d8181a2a60
|
@ -8,7 +8,7 @@
|
|||
(provide combinator-parser-tools@)
|
||||
|
||||
(define-unit main-parser@
|
||||
(import error^ out^ error-format-parameters^ language-format-parameters^)
|
||||
(import error^ out^ error-format-parameters^ language-format-parameters^ ranking-parameters^)
|
||||
(export parser^)
|
||||
|
||||
(define (sort-used reses)
|
||||
|
@ -73,8 +73,22 @@
|
|||
(!!! (car (repeat-res-stop
|
||||
(sort-repeats possible-repeat-errors))))))]
|
||||
[(and (choice-res? result) (fail-type? (choice-res-errors result)))
|
||||
(cond
|
||||
[(and (null? possible-repeat-errors)
|
||||
(null? possible-errors)) (!!! (fail-type->message (choice-res-errors result)))]
|
||||
[(or #;(not (null? possible-repeat-errors))
|
||||
(not (null? possible-errors)))
|
||||
(let ([fails (cons (choice-res-errors result)
|
||||
(map res-possible-error possible-errors))])
|
||||
#;(printf "we are gonna call fail-type->message ~a ~n" fails)
|
||||
;uncomment printf, stop the loop, get the error... wtf
|
||||
(!!! (fail-type->message
|
||||
(choice-res-errors result)))]
|
||||
(make-options-fail (rank-choice (map fail-type-chance fails))
|
||||
#f
|
||||
(choice-res-name result)
|
||||
(rank-choice (map fail-type-used fails))
|
||||
(rank-choice (map fail-type-may-use fails))
|
||||
fails))))])]
|
||||
[(not (null? possible-errors))
|
||||
;(printf "choice or pair fail~n")
|
||||
(!!! (fail-type->message
|
||||
|
|
|
@ -602,7 +602,7 @@
|
|||
(export top-forms^)
|
||||
|
||||
(define (top-member mems)
|
||||
(choice mems "program body"))
|
||||
(choice mems "class or interface"))
|
||||
|
||||
;Note -- should enfore name to be identifier.identifier instead of name
|
||||
(define import-dec
|
||||
|
@ -613,12 +613,12 @@
|
|||
(sequence (import name SEMI_COLON) id)) "import declaration")))
|
||||
|
||||
(define (make-program package import body)
|
||||
(let ([p&i (sequence (package import body) id "program")]
|
||||
[p (sequence (package body) id "program")]
|
||||
(let ([p&i (sequence (package import body) id "package program")]
|
||||
[p (sequence (package body) id "package program")]
|
||||
[i (sequence (import body) id "program")])
|
||||
(cond
|
||||
[(and package import)
|
||||
(choice (list p&i p i body) "program")]
|
||||
(choice (list p&i i ) "program")]
|
||||
[package
|
||||
(choice (list p body) "program")]
|
||||
[import
|
||||
|
@ -837,14 +837,14 @@
|
|||
(if-s (block #t) #f)
|
||||
(variable-declaration (value+name-type prim-type) expression #f "local variable")
|
||||
(block #t)
|
||||
(sequence (stmt-expr SEMI_COLON) id)) "statement")
|
||||
(choose ((return-s #t)
|
||||
(if-s (block #t) #f)
|
||||
(assignment
|
||||
(choose (identifier
|
||||
(sequence (unique-base (repeat unique-end) field-access-end) id))
|
||||
"assignee")
|
||||
EQUAL)
|
||||
(sequence (stmt-expr SEMI_COLON) id)) "statement")
|
||||
(choose ((return-s #t)
|
||||
(if-s (block #t) #f)
|
||||
(block #t)) "statement")))
|
||||
|
||||
(define statement (statement-c #f))
|
||||
|
|
Loading…
Reference in New Issue
Block a user