Skip to content

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

Open
mtstickney wants to merge 1 commit into
AccelerationNet:masterfrom
mtstickney:multi_state_entry_match
Open

Don't complete multi-state entries until they're actually done.#30
mtstickney wants to merge 1 commit into
AccelerationNet:masterfrom
mtstickney:multi_state_entry_match

Conversation

@mtstickney
Copy link
Copy Markdown

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.
@bobbysmith007
Copy link
Copy Markdown
Member

This looks reasonable to me, but I have not even opened lisp in 6ish years. Sorry that this was missed, it looks valid, but I am hesitant to merge it without being able to run the tests and without a test for this case.

If someone wants to merge this and run the tests, and report that it works still, I am happy to merge this

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.

2 participants