Adam Pippin
326e856a2b
Cleanup
3 years ago
Adam Pippin
0265db1946
Rework expression parser to not solve on creation; re-add dependency solving for variables in expressions in variables block
3 years ago
Adam Pippin
6f90b5d222
Bugfix: Fix processing order for functions -- deepest nodes first
3 years ago
Adam Pippin
8dd7b8d1f0
Re-add !expr function
3 years ago
Adam Pippin
4294c5b007
Add concat/select operators
3 years ago
Adam Pippin
6ddf1531af
Add boolean literals to expression parser
3 years ago
Adam Pippin
706242074d
Allow !replace to accept a scalar
This is the default merge behaviour, but simplifies using !replace because passing in a var that happens to evaluate to a scalar won't cause an issue anymore
3 years ago
Adam Pippin
9e5adfb9ce
Bugfix: !if that creates cfn conditions properly replaces parent node
3 years ago
Adam Pippin
a3fe71526d
Bugfix: generating Fn::If without false caused error
3 years ago
Adam Pippin
9a99fc315b
Bugfix: expression binary operators were dropping children
3 years ago
Adam Pippin
2b619d767b
Remove old expression parser
3 years ago
Adam Pippin
41b26006ac
Cleanup + comments
3 years ago
Adam Pippin
22aa9e068f
Update fn::if to use new expression parser and generate conditions where appropriate
3 years ago
Adam Pippin
f58cd9129d
Add an `addCondition` method to compiler for calling from functions
3 years ago
Adam Pippin
27774c84c6
Expression bug fix replacing variables; add string literal
3 years ago
Adam Pippin
5d0afd4984
Reimplement expression parser
Moving towards something a little more formal -- eventual goal here is that we can evaluate expressions as far as possible given everything available to us at the time and translate the rest into a cloudformation condition
3 years ago
Adam Pippin
01b036b284
Move cfnpp code out from under engine namespace
3 years ago
Adam Pippin
60f8d2be60
Also look at variables referenced in expressions when determining dependencies between variables
3 years ago
Adam Pippin
400542bc12
Specify some functions callable from expressions
3 years ago
Adam Pippin
6485b4f5a1
Add !expr function to allow inserting the result of evaluating an expression
3 years ago
Adam Pippin
a2d5324840
Allow expression evaluator to return an array if stack contains multiple values
3 years ago
Adam Pippin
d4d457340a
Fix bug in expression string literal parser
3 years ago
Adam Pippin
07e9fc2a3a
Cleanup
3 years ago
Adam Pippin
497f23594e
Add basic !if function
3 years ago
Adam Pippin
6b3eaa6833
First pass at expression parser/evaluator
3 years ago
Adam Pippin
b470283fde
Fix potential bug where using !unset on a variable would result in a crash
3 years ago
Adam Pippin
9f5dda08de
Add compiler pass 2 - run remaining functions
We're now back to where we started functionality-wise!
3 years ago
Adam Pippin
5a1b4f3402
Add compiler pass 1 -- resolve dependencies between variables and evaluate values
3 years ago
Adam Pippin
1cdadf4521
Have dependency graph throw an exception rather than return nothing when no edge nodes are present
3 years ago
Adam Pippin
1fd4bfb2b8
Cleanup
3 years ago
Adam Pippin
0c70de8e8a
Compiler pass 0 using new dependency graph/etc
This gets us back mostly to where we were, sans running non-merge !functions and variable/parameter support
3 years ago
Adam Pippin
9dbe97a3ec
Don't write state information into metadata from engine as all the actual state is now in compiler
3 years ago
Adam Pippin
d167f08e24
Add File::clear() to allow clearing and reusing/modifying file resolver
3 years ago
Adam Pippin
be9857cd2f
Add super rudimentary dependency graph solver
3 years ago
Adam Pippin
145b89da1e
Add generic methods for converting DOM<->PHP, updated places where this is useful
3 years ago
Adam Pippin
1bb3e50cfb
Move cfnpp stuff into its own namespace
3 years ago
Adam Pippin
8722279af6
Remove all logic besides "load files, pass to compiler" from Engine
3 years ago
Adam Pippin
4b26a910af
Have the compiler passed the entire set of documents + state to facilitate moving the higher-level compilation logic into the compiler
We're moving a bunch of the compilation logic building up inside Engine into the compiler
3 years ago
Adam Pippin
f3a3d21a36
Track parameters like variables
Not in love with this. Cannot use !functions in variables/parameters block because they're grabbed before being compiled.
3 years ago
Adam Pippin
c0b4fd7dd3
Code cleanup
3 years ago
Adam Pippin
300de19fe5
Bugfix: recent list of includes between each file
The one time I don't get lazy and initialize my variables...
3 years ago
Adam Pippin
6ce8dec215
Add !var to use value of variable as value
3 years ago
Adam Pippin
6b8439e3c2
Bugfix: don't try and iterate over the thing we're modifying
3 years ago
Adam Pippin
4056674c1d
Rework Engine::process, handle variables in meta block
3 years ago
Adam Pippin
0f6185d9d8
Update compiler options to hold variables
3 years ago
Adam Pippin
de247299cd
Pass options in to compiler at construction instead of with each pass
We're going to use 'options' to also hold some mutated state, so let's just keep it simple
3 years ago
Adam Pippin
2f197b4b51
Update domdocument to allow fetching maps from meta
3 years ago
Adam Pippin
56a023959f
Fix off by... many error -- only walk array index back 1 to reprocess, not more
3 years ago
Adam Pippin
460168401e
Write list of yaml files processed to Metadata section of output (poc)
3 years ago
Adam Pippin
db66e2cabf
Replace findNodeByPath with iterative implementation
3 years ago