summaryrefslogtreecommitdiff
path: root/mesonbuild/ast/printer.py
AgeCommit message (Collapse)Author
2025-12-22ast: printer: give a precedence to all kinds of functionsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-08interpreterbase: make ArithmeticNode and MesonOperator both use operator namesPaolo Bonzini
This avoids creating a dictionary every time an arithmetic operator is evaluated. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-08make ctype the same as the printed ASTPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-29AstPrinter: Add parenthesis where neccessaryVolker Weißmann
2025-05-29AstPrinter: Use str.translate instead of str.replaceVolker Weißmann
2024-04-08parser: revert to single StringNode typeCharles Brunet
this will allow transforming string types in the formater
2024-04-08simplify astprinter by using operator valueCharles Brunet
2024-04-08simplify RawPrinter using FullAstVisitorCharles Brunet
2024-04-08fix colon wrongly named column in parserCharles Brunet
In #02ff955, I used the word `columns` instead of `colons`, but the meaning really was about the ':' symbol.
2024-04-08Fix type checking in ast.printerCharles Brunet
- Wrong types were used for MultilineStringNode and FormatMultilineStringNode - Simplify the `escape` method to avoid use of T.Cast
2024-02-26printer: Add a newline after "else"Xavier Claessens
2024-02-26printer: notin operator should be printed as "not in"Xavier Claessens
2024-01-08ast/printer: fix mypy issuesDylan Baker
Other than one case that I think cannot be actually hit (or it would fail).
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-09-11raw printerCharles Brunet
this printer preserves all whitespaces and comments in original meson.build file. It will be useful for rewrite and potential auto-formatter
2023-09-11parser: use IdNode for foreach varnamesCharles Brunet
2023-09-11parser: use IdNode for function name and assignment nameCharles Brunet
2023-09-11parser: preserve escape chars in stringsCharles Brunet
use separate Node for multiline strings
2023-08-11treewide: automatic rewriting of all comment-style type annotationsEli Schwartz
Performed using https://github.com/ilevkivskyi/com2ann This has no actual effect on the codebase as type checkers (still) support both and negligible effect on runtime performance since __future__ annotations ameliorates that. Technically, the bytecode would be bigger for non function-local annotations, of which we have many either way. So if it doesn't really matter, why do a large-scale refactor? Simple: because people keep wanting to, but it's getting nickle-and-dimed. If we're going to do this we might as well do it consistently in one shot, using tooling that guarantees repeatability and correctness. Repeat with: ``` com2ann mesonbuild/ ```
2023-02-28refactor a few subsystem-relative imports that imported the wrong locationEli Schwartz
Inside of mesonbuild.ast.* we can and should import from .foobar, rather than importing from .__init__'s re-exported version of that object. Failing to do so results in an extremely brittle codebase where simply changing the order of lines in __init__.py can result in ImportError.
2023-02-01treewide: add future annotations importEli Schwartz
2022-10-03pylint: enable unnecessary-comprehensionDylan Baker
2022-09-07Fixed string escaping in AstPrinterVolker Weißmann
2022-05-24ast: cmake: Generate line numbers while printing the AST for better debuggingDaniel Mensinger
2021-07-25ast: Add dummy "support" for fstrings in the ast packageDaniel Mensinger
2021-06-16Fix assert(not true) raising backtraceXavier Claessens
When no message is provided to assert(), it uses the ast printer to show the condition that failed. In this case the 'not' is the first string appended to the result, self.result[-1] would raise range error.
2020-05-23ast: Add AST JSON printerDaniel Mensinger
2020-03-02types: Remove redundant __init__() -> None annotationDaniel Mensinger
2020-03-02types: Annotate the AST visitorsDaniel Mensinger
2020-03-02types: Annotate mparser.pyDaniel Mensinger
This also fixes that the keys in ArgumentNode.kwargs are all of the type BaseNode now. Before this commit, it was possible that both strings and Nodes where used as keys.
2019-12-10assert(): Make message argument optionalXavier Claessens
2019-06-28ast: printer fix index node printingDaniel Mensinger
2019-04-25ast/printer: remove useless ternaryDylan Baker
The ternary returns True or False from an expression that returns True or False: i.e. True if bool(value) else False.
2019-01-24Fixed style issuesDaniel Mensinger
2019-01-22Can now rewrite filesDaniel Mensinger
2019-01-22AST post processingDaniel Mensinger
2019-01-22Added Ast printerDaniel Mensinger
2019-01-22Basic AST visitor patternDaniel Mensinger