Parse two word directed commands - #86
Merged
punk-kaos merged 1 commit intoAug 30, 2026
Merged
Conversation
…he parser took the command as a single whitespace token, so MSG TO: arrived as MSG with the destination glued to the payload, and QUERY MSGS arrived as QUERY. The new Js8Commands table mirrors kDirectedCmds from the native varicode source and matches longest name first, so the two-word names parse whole. Unrecognized text falls back to the old single-token shape, so free-text frames reach callers unchanged. A unit test reads the native table out of varicode.cpp and fails when the Kotlin copy drifts from it. Removed the MSG handler's inline-payload extraction rather than teaching it about MSG TO:. It existed to handle a command token with the payload stuck to it, a shape the engine cannot produce: a directed frame unpacks its command from the table by index, and the JNI joins the parts with explicit separators. It was dead code until now, but MSG TO: parsing as a whole command would have set it off and put a stray TO: into the delivered text. The MSG branch now matches the two commands it actually handles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
MSG TO:andQUERY MSGSwhole instead of stopping at the first wordWhy
The store and forward work I have planned builds on this.
MSG TO:arrived asMSGwith the destination glued to the payload, andQUERY MSGSarrived asQUERY.MSGHELLO. That shape can't reach the parser: directed frames unpack their command from the table by index and the JNI joins the parts with explicit spaces. It was dead code until now, butMSG TO:parsing whole would have set it off and put a strayTO:in the message text.Test
./gradlew :app:testDebugUnitTest(20 tests, 8 of them new, all passing)kotlinTableMatchesNativeVaricodeTablefails and prints the disagreement.