On Tue, Oct 6, 2009 at 11:25 PM, Steven Roussey <[email protected]> wrote:
>
>> And of course the main point is that arguments to
>> formatters/predicates are parsed inside application code
>> ... JSON Template doesn't parse any arguments.
>
> I switched it a long time ago to not parse the arguments themselves.
> What I do parse is the boundary point between the formatter/predicate
> and its arguments. That way I can just use an array of formatters and
> an array of predicates, which has fast and easy lookup. They get the
> rest of the string, at which point, each individual function has to
> parse it's arguments to meet its needs and/or style. And there is
> still more_formatters/more_predicates in case the user wants the whole
> string that includes the predicate name and arguments, for it to
> figure out.
Yeah, but you are assuming that the name is alphanumeric and such.
This is just going to be a source of maintenance and bugs. I'd rather
defer it entirely to the app. Especially since it's actually less
work that way.
Take a look at the recent Python changes. I think that is the right
API (FunctionRegistry); if not we can discuss.
369 var _IF_RE = /^if\s+([...@a-za-z0-9_-]+)(?:\s+(.*?))?\s*$/;
370 var _CALL_RE = /^([A-Za-z0-9_-]+)(?:\b\s*(.*?))?\s*$/;
Andy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JSON
Template" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/json-template?hl=en
-~----------~----~----~----~------~----~------~--~---