Commit Graph

20 Commits

Author SHA1 Message Date
Charles Brunet bd4fd90730 parser: revert to single StringNode type
this will allow transforming string types in the formater
2024-04-08 10:43:57 -07:00
Charles Brunet be9e9af15a Add ast visitor for whitespaces and symbols
The `AstVisitor` intentionally ignores whitespaces and symbols,
as they are not useful for tne interpreter. However, when formatting a
build file, we need them. This commit introduces a `FullAstVisitor` that
visits every Nodes, including whitespaces and symbols.
2024-04-08 10:43:57 -07:00
Dylan Baker 5cd1147354 ast/printer: fix mypy issues
Other than one case that I think cannot be actually hit (or it would
fail).
2024-01-08 19:33:05 -05:00
Dylan Baker e991c4d454 Use SPDX-License-Identifier consistently
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-12-13 15:19:21 -05:00
Charles Brunet 02ff9553db parser: add SymbolNode to preserve operators 2023-09-11 07:51:18 -04:00
Charles Brunet f13260dd43 parser: add ElseNode 2023-09-11 07:51:18 -04:00
Charles Brunet 8d357ba62c parser: use IdNode for foreach varnames 2023-09-11 07:51:18 -04:00
Charles Brunet 306562b466 parser: use IdNode for function name and assignment name 2023-09-11 07:51:18 -04:00
Charles Brunet 35936283d2 parser: preserve escape chars in strings
use separate Node for multiline strings
2023-09-11 07:51:18 -04:00
JCWasmx86 79ed2415e9 Add ParenthesizedNode 2023-09-11 07:51:17 -04:00
Eli Schwartz 0703ee0aef
move various unused typing-only imports into type-checking blocks 2022-07-03 14:11:31 -04:00
Daniel Mensinger bf41d56597 ast: Add dummy "support" for fstrings in the ast package 2021-07-25 21:36:52 +03:00
Daniel Mensinger 3489442848
typing: completely type ast 2020-09-08 20:15:55 +02:00
Daniel Mensinger 96eeef62ea
ast: Add AST JSON printer 2020-05-23 18:13:16 +02:00
Daniel Mensinger d67888bf9b
types: Remove redundant __init__() -> None annotation 2020-03-02 10:52:59 +01:00
Daniel Mensinger a75255bc4c
types: Annotate the AST visitors 2020-03-02 10:34:55 +01:00
Daniel Mensinger 35b4ae5d61
ast: printer fix index node printing 2019-06-28 13:22:37 +02:00
Daniel Mensinger 2b5831f94f
Fix flake8-bugbear warnings 2019-04-29 12:22:50 +02:00
Daniel Mensinger 277dc10a5d
AST post processing 2019-01-22 16:09:34 +01:00
Daniel Mensinger ccad493e85
Basic AST visitor pattern 2019-01-22 16:09:34 +01:00