Fixing documentation

This commit is contained in:
Matthias Koefferlein 2024-08-16 23:21:01 +02:00
parent 9da5aaf491
commit a338e53527
1 changed files with 16 additions and 15 deletions

View File

@ -756,7 +756,7 @@ Class<tl::Eval> decl_ExpressionContext ("tl", "ExpressionContext",
"ctx = ExpressionContext::new\n"
"ctx.func('myfunction', MyFunction::new)\n"
"ctx.eval('myfunction(17)') # gives 18\n"
"@endcode\n"
"@/code\n"
"\n"
"This method has been introduced in version 0.29.7."
) +
@ -793,7 +793,7 @@ Class<tl::Eval> decl_ExpressionContext ("tl", "ExpressionContext",
Class<ExpressionWrapper> decl_ExpressionWrapper (decl_ExpressionContext, "tl", "Expression",
gsi::constructor ("new", &new_expr0,
"@brief Creates a new expression evaluator for late compilation\n"
"Use \\var to define variables, \\func to define functions and use \\text= to compile an expression.\n"
"Use 'var' to define variables, 'func' to define functions and use \\text= to compile an expression.\n"
"\n"
"This constructor has been added in version 0.29.7."
) +
@ -804,7 +804,7 @@ Class<ExpressionWrapper> decl_ExpressionWrapper (decl_ExpressionContext, "tl", "
"sharing variables among multiple expressions.\n"
"\n"
"Note that the expression object will not hold a strong reference to the parent context. It "
"will get lost of the variable holding the parent context goes out of scope.\n"
"will get lost if the variable holding the parent context goes out of scope.\n"
"\n"
"This constructor has been introduced in version 0.29.7."
) +
@ -812,14 +812,14 @@ Class<ExpressionWrapper> decl_ExpressionWrapper (decl_ExpressionContext, "tl", "
"@brief Creates a new expression object with a parent and a global context.\n"
"Variables and functions not found in this context are looked up in the parent context and "
"finally in the global context.\n"
"The parent and the global context themselves can have another parent contexts. Parent and global contexts allow "
"The parent and the global context themselves can have parent contexts themselves. Parent and global contexts allow "
"sharing variables among multiple expressions.\n"
"\n"
"Without a global context given, the expressions will use the global context singleton that is available to "
"Without a global context given, the expressions will use the global context singleton which is available to "
"all expressions.\n"
"\n"
"Note that the expression object will not hold a strong reference to the parent or global context. These contexts "
"will get lost of a variable holding them goes out of scope.\n"
"will get lost if a variable holding them goes out of scope.\n"
"\n"
"This constructor has been introduced in version 0.29.7."
) +
@ -861,7 +861,8 @@ Class<ExpressionWrapper> decl_ExpressionWrapper (decl_ExpressionContext, "tl", "
"\n"
"This class allows evaluation of expressions. Expressions are used in many places throughout KLayout and "
"provide computation features for various applications. Having a script language, there is no real use for expressions "
"inside a script client. This class is provided mainly for testing purposes.\n"
"inside a script client. This class is provided mainly for testing purposes or if a safer alternative to script "
"evaluation is needed - for example in PCell input string evaluation.\n"
"\n"
"An expression is 'compiled' into an Expression object and can be evaluated multiple times.\n"
"The Expression object is based on the \\ExpressionContext object which provides a namespace for variables \n"
@ -873,12 +874,12 @@ Class<ExpressionWrapper> decl_ExpressionWrapper (decl_ExpressionContext, "tl", "
"e = RBA::Expression::new\n"
"e.var('A', 17)\n"
"e.text = 'A + 1'\n"
"e.eval # gives 18\n"
"e.eval() # gives 18\n"
"e.var('A', 2)\n"
"e.eval # gives 3\n"
"e.eval() # gives 3\n"
"@/code\n"
"\n"
"Expressions allow to share variables among multiple expressions through parent contexts:\n"
"Expressions allow sharing variables among multiple expressions through parent contexts:\n"
"\n"
"@code\n"
"pc = RBA::ExpressionContext::new\n"
@ -886,20 +887,20 @@ Class<ExpressionWrapper> decl_ExpressionWrapper (decl_ExpressionContext, "tl", "
"\n"
"e1 = RBA::Expression::new(pc)\n"
"e1.text = 'A + 1'\n"
"e1.eval # gives 18\n"
"e1.eval() # gives 18\n"
"\n"
"e2 = RBA::Expression::new(pc)\n"
"e2.text = 'A + 2'\n"
"e2.eval # gives 19\n"
"e2.eval() # gives 19\n"
"\n"
"# modifying 'A' in pc changes input for both expressions\n"
"pc.var('A', 2)\n"
"e1.eval # gives 3\n"
"e2.eval # gives 4\n"
"e1.eval() # gives 3\n"
"e2.eval() # gives 4\n"
"@/code\n"
"\n"
"The Expression class has been introduced in version 0.25. In version 0.26 it was separated into execution and context.\n"
"In version 0.29.6, the context was significantly enhanced towards parent contexts and functions.\n"
"In version 0.29.7, the context was significantly enhanced towards parent contexts and functions.\n"
);
static tl::GlobPattern *new_glob_pattern (const std::string &s)