2 GTSAM Copyright 2010-2020, Georgia Tech Research Corporation,
3 Atlanta, Georgia 30332-0415
6 See LICENSE for the license information
8 Parser classes and rules for parsing C++ variables.
10 Author: Varun Agrawal, Gerry Chen
13 from typing
import List
15 from pyparsing
import Optional, ParseResults
17 from .tokens
import DEFAULT_ARG, EQUAL, IDENT, SEMI_COLON
18 from .type
import TemplatedType, Type
23 Rule to parse variables.
24 Variables are a combination of Type/TemplatedType and the variable identifier.
29 string name; // This is a property variable.
32 Vector3 kGravity; // This is a global variable.
35 rule = ((Type.rule ^ TemplatedType.rule)(
"ctype")
37 + Optional(EQUAL + DEFAULT_ARG)(
"default")
42 t.default[0]
if isinstance(t.default, ParseResults)
else None))
47 default: ParseResults =
None,