Monday, January 21, 2019

Enforcing the file name syntax

Default promoted these two pairs to first class:  // and ./ The console loop enforces this, and will throw a syntax error if the context wants a file name and these are not there. Later, I will put in the cheat to look add the local operator, ./

Now we can easily mix file names with args on the command line, and follow one command with a variable length args listfor further nested commands.

But in test and integration, enforcing that rule completely save a bunch of spaghetti which hinders the integration testing.  It is a one line to check, and throw the error, and I know immediately what I did, not searching.

Also I trust the tokenizer on parsing out a file name as one string, so the work is done when dealing with files in console loop. If tokenize fail, it is an easy debug as it is an isolated unit, string in array out.

All the short paths I find, and mark with syntax checks, results in easy checks for any other syntax machine that wants to deal with console loop.  They can seethe short path, and from there is it obvious what they want to configure in tokenize, or leave the command as a scalar string in arg1.

At this point, I still get code consolidation and reuse, as readers can see with the success of the commons.  Marking hard, concrete interfaces makes unit testing smooth. I always make sure each snippet has a standard one test mode. This is all working, the flush can be et up with one command line:

LoadModule //home/so/flush xchars flushbox;

On Loadmodule, the console does not disturb arguments past the flush name, and he following arguments are consumed in init.

 But the concept applies elsewhere, and anytime snippets agree on the form. Console can deliver an entire sequence to flush, which then delivers a portion to xchars, thus setting the entire chain. But the concept is a disaster of confusion if a common recursion is not accepted, a typedef that everyone will grab.

For example, arguments as a stack. Pull off what you need,then turn the stack over to the next entry in the stack.  The stack can be mapped onto a portion of args.  Semi colon does not get us a recursion in command depth, but it is a great tool anyway.  Default will est  a follow on syntax engine withing a while loop, for example, and Default can be nested. At anytime,  new module can execute a simple initialization in default, if they choose, then we have programmability a load time.

No comments: