dyn: fails to parse some arguments
If I change dyn/algos.hh
to have this:
expression random_expression(const context& ctx,
const std::string& param = "+, ., *=.2, w., .w, length=10",
identities ids);
then it breaks:
akim@erebus ~/src/lrde/2 $ 39s -j3 130 15:50:56
/Users/akim/src/gostai/common/build-scripts/build-for-pc: Entering directory `_build/39s'
GEN vcsn/dyn/algos.json.stamp
Traceback (most recent call last):
File "/Users/akim/src/lrde/2/build-aux/bin/dyn-json", line 123, in <module>
process_header(args.input, args.output)
File "/Users/akim/src/lrde/2/build-aux/bin/dyn-json", line 108, in process_header
algos.append(process_function(m.groupdict()))
File "/Users/akim/src/lrde/2/build-aux/bin/dyn-json", line 98, in process_function
fun['formals'] = [formal_re.match(f).groupdict() for f in fun['formals']]
File "/Users/akim/src/lrde/2/build-aux/bin/dyn-json", line 98, in <listcomp>
fun['formals'] = [formal_re.match(f).groupdict() for f in fun['formals']]
AttributeError: 'NoneType' object has no attribute 'groupdict'
Makefile:4782 : la recette pour la cible « vcsn/dyn/algos.json.stamp » a échouée
gmake: *** [vcsn/dyn/algos.json.stamp] Erreur 1
Compilation FAILED: /Users/akim/src/lrde/2: build-for-darwin -j3 exit 2
I seems it does not like the commas in the default argument value. It should be made more robust.
I remember I did something like that in Python, but Sarasvati recently made all this code useless :)
- # Using split(',') is tempting, but will break strings
- # that contain commas --- e.g., [label = "a, b"].
- def attr_dot_split(self, s):
- attr = r'{id}(?:\s*=\s*{id})?'.format(id=self.id)
-
- scanner = re.Scanner([
- (",;", None),
- (attr, lambda scanner, tok: tok),
- (r"\s+", None),
- ])
- return scanner.scan(s)[0]
See cc40bc82. there are probably other approaches.