Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't complete multi-state entries until they're actually done. #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mtstickney
Copy link

When matching a multi-state entry, we need to differentiate between
determining whether the entry matches, and completing that state. A multi-
state entry should only be completed when we've reached the last of its
states. This is accomplished by returning the the completion function or
nil as the the primary value from check-table-entry, and a secondary value
indicating whether the entry matched.

Currently, the completion function is always called when the entry matches,
which manifests as the following bug (using interpol syntax for strings):

* (cl-csv:read-csv:read-csv #?|1,2,"abc"\r\n| :trim-outer-whitespace nil)

debugger invoked on a CL-CSV:CSV-PARSE-ERROR in thread
#<THREAD "main thread" RUNNING {10005185B3}>:
  whitespace after quoted data thats not supposed to be trimmed #<CSV-READER LINE-IDX:0 CHARACTER-LINE-IDX:10 CHARACTER-IDX:10 "abc" {1001D703F3}> 

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(CL-CSV:CSV-PARSE-ERROR "whitespace after quoted data thats not supposed to be trimmed ~a ~a" #<CL-CSV::CSV-READER LINE-IDX:0 CHARACTER-LINE-IDX:10 CHARACTER-IDX:10 "abc" {1001D703F3}> #\Return)
   source: (ERROR 'CSV-PARSE-ERROR :FORMAT-CONTROL MSG :FORMAT-ARGS ARGS)

When matching a multi-state entry, we need to differentiate between
determining whether the entry matches, and completing that state. A multi-
state entry should only be completed when we've reached the last of its
states. This is accomplished by returning the the completion function or
NIL as the the primary value from CHECK-TABLE-ENTRY, and a secondary value
indicating whether the entry matched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant