aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/parser.cxx
AgeCommit message (Collapse)AuthorFilesLines
2024-02-07Add support for nested subscript, use for json accessBoris Kolpackov1-89/+95
2024-02-07Add experimental support for JSON value typesBoris Kolpackov1-24/+100
New types: json json_array json_object New functions: $json.value_type(<json>) $json.value_size(<json>) $json.member_{name,value}(<json-member>) $json.object_names(<json-object>) $json.array_size(<json-array>) $json.array_find(<json-array>, <json>) $json.array_find_index(<json-array>, <json>) $json.load(<path>) $json.parse(<text>) $json.serialize(<json>[, <indentation>]) For example, to load a JSON value from a file: j = $json.load($src_base/board.json) Or to construct it in a buildfile: j = [json] one@1 two@([json] 2 3 4) three@([json] x@1 y@-1) This can also be done incrementally with append/prepend: j = [json_object] j += one@1 j += two@([json] 2 3 4) j += three@([json] x@1 y@-1) Instead of using this JSON-like syntax, one can also specify valid JSON input text: j = [json] '{"one":1, "two":[2, 3, 4], "three":{"x":1, "y":-1}' Besides the above set of functions, other handy ways to access components in a JSON value are iteration and subscript. For example: for m: $j print $member_name($m) $member_value($m) print ($j[three]) A subscript can be nested: print ($j[two][1]) print ($j[three][x]) While a JSON value can be printed directly like any other value, the representation will not be pretty-printed. As a result, for complex JSON values, printing a serialized representation might be a more readable option: info $serialize($j)
2024-02-06Add support for value type-specific subscript and iterationBoris Kolpackov1-89/+128
2024-02-06Fix bunch of maybe used uninitialized warningsBoris Kolpackov1-1/+1
2024-01-16Don't enter exported buildfile as real targets (GH issue #357)Boris Kolpackov1-2/+4
In particular, this used to prevent file_rule from match such targets for clean.
2024-01-15Add no_default_target attribute for source, buildfile import directivesBoris Kolpackov1-12/+56
This attribute can be used to disable the default target semantics for the sources/imported buildfile.
2024-01-15Disable default target semantics when loading {bootstrap,root}.buildBoris Kolpackov1-2/+6
2024-01-15Automatically alias unknown target types of imported targetsBoris Kolpackov1-7/+26
2024-01-15Fail with unable to import rather than unknown target typeBoris Kolpackov1-3/+18
2024-01-11Add ability to alias target type from another projectBoris Kolpackov1-34/+104
The syntax is: define <type> = <scope>/<type>
2024-01-09Allow imported buildfiles to using config.* variables from own projectBoris Kolpackov1-28/+161
2023-12-04Improve parser diagnosticsBoris Kolpackov1-1/+5
2023-11-02Minor diagnostics improvementBoris Kolpackov1-1/+1
2023-11-01Add notion of match optionsBoris Kolpackov1-1/+2
Now, when matching a rule, the caller may request a subset of the full functionality of performing an operation on a target. This is achieved with match options.
2023-10-26Minor diagnostics improvementBoris Kolpackov1-4/+12
2023-08-02Diagnose declarations of targets/prerequisites with abstract target typesBoris Kolpackov1-0/+25
2023-06-26Omit dangling symlink warning for backlinked executablesBoris Kolpackov1-13/+44
2023-06-09Diagnose multiple values in typed concatenation (GH issue #263)Boris Kolpackov1-26/+41
2023-06-08Add support for buildfile importationBoris Kolpackov1-105/+377
2023-05-31Provide implied configure_* and dist_* action registration for ad hoc recipesBoris Kolpackov1-2/+11
This makes it consistent with the existing ad hoc rules semantics.
2023-05-29Explicit group: pattern membersBoris Kolpackov1-12/+18
2023-05-29Explicit group: dynamic membersBoris Kolpackov1-2/+2
2023-05-29Explicit group: static membersBoris Kolpackov1-0/+3
2023-05-29Explicit group: syntax parsingBoris Kolpackov1-121/+403
2023-05-16Enter export stub targets with correct outBoris Kolpackov1-12/+36
2023-05-09Add support for dumping build system state in JSON format (GH issue #182)Boris Kolpackov1-2/+6
Specifically: 1. New --dump-format option. Valid values are `buildfile` and `json-v0.1`. 2. The --dump option now recognizes two additional values: `match-pre` and `match-post` to dump the state of pre/post-operations. The `match` value now only triggers dumping of the main operation.
2023-05-03Add --dump-scope and --dump-target options to limit --dump outputBoris Kolpackov1-2/+2
2023-01-31Minor improvement to diagnosticsBoris Kolpackov1-2/+6
2022-12-19Disable `)` escaping in buildspec, command line variable overridesBoris Kolpackov1-6/+5
Similar to line continuations, that would make directory paths on Windows unusable, for example: b info(C:\myproj\) Note that while this is less of a problem in command line variable overrides, we disable it there for consistency.
2022-12-19Disable line continuation in buildspec, command line variable overridesBoris Kolpackov1-4/+6
Line continuations would make directory paths on Windows unusable, for example: b C:\myproj\
2022-12-19Restore newline escaping (line continuations) in double-quoted stringsBoris Kolpackov1-3/+4
Also make effective escaping in buildspec and command line variable overrides consistent with double-quoted strings.
2022-12-15Add noexcept to move constructors and move assignment operatorsKaren Arutyunov1-6/+6
2022-12-15Improve escape sequence supportBoris Kolpackov1-125/+167
Specifically: 1. In the double-quoted strings we now only do effective escaping of the special `$("\` characters plus `)` for symmetry. 2. There is now support for "escape sequence expansion" in the form $\X where \X can be any of the C/C++ simple escape sequences (\n, \t, etc) plus \0 (which in C/C++ is an octal escape sequence). For example: info "foo$\n$\tbar$\n$\tbaz" Will print: buildfile:1:1: info: foo bar baz
2022-12-14Improve empty simple value to empty list of names reduction heuristicsBoris Kolpackov1-17/+45
Specifically, do not reduce typed RHS empty simple values for prepend/append and additionally for assignment provided LHS is typed and is a container.
2022-12-14Handle NULL values in $string() and $concat() functionsBoris Kolpackov1-1/+2
This is relied upon by the parser to provide conversion/concatenation semantics consistent with untyped values. Note that we handle NULL values only for types that have empty representation.
2022-12-12Adapt to dir_iterator API changeKaren Arutyunov1-1/+14
2022-12-02Fail if scope or target qualification in variable expansion is unknownBoris Kolpackov1-29/+69
There are three options here: we can "fall through" to an outer scope (there is always the global scope backstop; this is the old semantics, sort of), we can return NULL straight away, or we can fail. It feels like in most cases unknown scope or target is a mistake and doing anything other than failing is just making things harder to debug.
2022-11-29Move buildfiles to root_extra, use vector instead of unordered_setBoris Kolpackov1-1/+3
2022-11-29Improve diagnostics for value subscript out of evaluation contextBoris Kolpackov1-2/+21
2022-11-23Rework diag_buffer interface to facilitate correct destruction orderBoris Kolpackov1-1/+1
2022-11-08Make process exit diagnostics consistentBoris Kolpackov1-1/+1
In particular, we now always print error message on non-0 exit except in cases where such exit is ignored.
2022-11-08More work on child process diagnostics bufferingBoris Kolpackov1-2/+5
2022-10-27Suppress (potential) bogus GCC 12 -Wrestrict warningsBoris Kolpackov1-1/+1
2022-10-25Allow concatenation of path/dir_path type to be a path patternKaren Arutyunov1-6/+49
2022-10-24Allow non-parallel absolute src/out to support imported target taggingBoris Kolpackov1-11/+11
Also fix bug in out clearing.
2022-10-21Change attribute syntax in script to come after variable in set and for (set ↵Karen Arutyunov1-21/+25
x [...], for x [...])
2022-10-20Tweak documentation in parser::parse_for()Karen Arutyunov1-2/+2
2022-10-20Add support for for-loop element typeKaren Arutyunov1-8/+24
2022-10-20Diagnose incorrect output directory specificationBoris Kolpackov1-1/+24
2022-10-14Fix 'for [<attrs>] x: ...' to treat <attrs> as value attributesKaren Arutyunov1-12/+0