|
From: Simon J. <sje...@bl...> - 2004-06-19 10:07:10
|
Vladimir Senkov wrote: > Hi All, > > I have a few proposals for the tokenizer/parser issue. > First i'd like to wrap the filename in doublequotes. I have my mind > set on that and i think it's the right thing to do so stop me now or > i'll check that in. > Second i'm trying to figure out what to do about driver parameters. > Two ideas here: > 1) wrap them (for the lack of a better idea, again in doublequotes). > This is OK, but what about value pairs? Should i wrap the whole thing > or individual pair or individual names? for example: > GET AUDIO_OUTPUT_DRIVER INFO "ALSA" > GET AUDIO_OUTPUT_DRIVER_PARAMETER INFO "ALSA" "CARD" > CREATE AUDIO_OUTPUT_DEVICE "ALSA" "CARD='0,0' FRAGMENTS=3" > or > CREATE AUDIO_OUTPUT_DEVICE "ALSA" "CARD='0,0'" "FRAGMENTS=3" > or > CREATE AUDIO_OUTPUT_DEVICE "ALSA" "CARD"='0,0' "FRAGMENTS"=3 I'd suggest CREATE AUDIO_OUTPUT_DEVICE "ALSA" Card="0,0" Fragments=3 or CREATE AUDIO_OUTPUT_DEVICE ALSA Card="0,0" Fragments=3 depending on whether we think "ALSA" is a name or a string in this context. (Its not a key name or a string value so i haven't thought about it yet). > 2) make some rule that will help us to make sure that they don't match > any tokens. I don't want to just tell people "make sure they are > different" because that is not going to happen. Those things are at > runtime, our spec is going to keep changing for a little while . . . > So, the idea is to perhaps make a rule that all string parameters and > string values MUST be lowercase and all tokens MUST be uppercase. > Or maybe parameters and values don't have to all be lowercase, but > MUST at least have one lowercase character in them :) For the key names, the rule [A-Z_][A-Za-z0-9_]* /* MUST not match a keyword */ is sufficient to fix the lexer/parser. Key names are chosen by linuxsampler coders ( <--- is this /always/ true? ) so its a reasonable and enforceable rule. OTOH adopting the convention that key names are mixed or lower case wouldn't hurt either, so i showed "Card" and "Fragments" in mixed case in my example above. The same rule would work for strings too, but its not reasonable or enforceable. We want strings like "Monitor Left" and "0,0" which contain whitespace and punctuation, and cannot prevent a user from trying to name a channel "CHANNEL" or "8" or "CHANNEL 8", nor would we want to. So string values should be in quotes. Simon Jenkins (Bristol, UK) |