Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
72f73aa
improve `bar_index`
bvasilenko Jan 14, 2026
a5112c3
data fetcher for tests
bvasilenko Jan 14, 2026
1c229f0
go PineExecutor for integration tests
bvasilenko Jan 14, 2026
1a2f04a
unskip actualized tests
bvasilenko Jan 14, 2026
c12cc18
update docs
bvasilenko Jan 14, 2026
e5f15bd
reorganize dir structure
bvasilenko Jan 15, 2026
d4d8772
add frozen-data regression testing
bvasilenko Jan 15, 2026
348ec0a
cleanup
bvasilenko Jan 15, 2026
378babb
update docs
bvasilenko Jan 15, 2026
46c28ab
update golden regression references
bvasilenko Jan 15, 2026
a84eb3a
add `Supertrend Strategy` regression test
bvasilenko Jan 15, 2026
d3cb369
add `BB + RSI Strategy` regression test
bvasilenko Jan 15, 2026
6e01ea5
add `MACD Crossover Strategy` regression test
bvasilenko Jan 15, 2026
c563abd
add `EMA Crossover (Triple EMA)` regression test
bvasilenko Jan 15, 2026
53da669
add `Ichimoku Cloud Strategy` regression test
bvasilenko Jan 15, 2026
ad512e3
add `ADX + DI Strategy` regression test
bvasilenko Jan 15, 2026
6e57cde
update golden reference data
bvasilenko Jan 15, 2026
b306bef
add `Volume Weighted Strategy` regression test
bvasilenko Jan 15, 2026
9b4c735
update golden reference data
bvasilenko Jan 15, 2026
4e1f6e2
add `Keltner Channel Squeeze` regression test
bvasilenko Jan 15, 2026
93444dc
add `Pivot Points Reversal` regression test
bvasilenko Jan 15, 2026
7a22f16
add `Multi-Timeframe Confirmation` regression test
bvasilenko Jan 15, 2026
c36d2f8
fix blocker: add Strategy Equity method
bvasilenko Jan 15, 2026
2436943
update docs
bvasilenko Jan 15, 2026
b032f88
streamline binance API provider
bvasilenko Jan 16, 2026
b8f8ebe
reorganize dir structure
bvasilenko Jan 16, 2026
ebec7a0
fix ta.crossover/under
bvasilenko Jan 16, 2026
405226f
opposite trade closing logic
bvasilenko Jan 17, 2026
ab8b88e
update tests
bvasilenko Jan 17, 2026
b853058
fix ta.atr(inputVar)
bvasilenko Jan 16, 2026
b4a2364
update docs
bvasilenko Jan 16, 2026
48201e3
add input.source handling, conditional entry, persistent exit orders
bvasilenko Jan 17, 2026
cb60f46
add position reversal handler, tuple destructuring, MTF golden tests
bvasilenko Jan 18, 2026
5e795b0
update docs
bvasilenko Jan 18, 2026
5f25d7f
add pyramiding parameter
bvasilenko Jan 19, 2026
05f2542
update docs
bvasilenko Jan 19, 2026
ecd5914
improve `crossover/crossunder` impl
bvasilenko Jan 19, 2026
244e3f4
add ta.tr MemberExpression support in TA function arguments
bvasilenko Jan 20, 2026
f2bd956
update docs
bvasilenko Jan 20, 2026
146d8b6
add array literal and parenthesized expression parsing
bvasilenko Jan 20, 2026
ea1dda2
add derived price builtin support in TA function arguments
bvasilenko Jan 20, 2026
934eaa6
refactor derived price builtins with single source of truth
bvasilenko Jan 21, 2026
57a07ba
fix derived price test coverage and handler edge cases
bvasilenko Jan 21, 2026
d20c162
add `ta.rsi()` support
bvasilenko Jan 21, 2026
0faff6b
add conditional expression support in function arguments
bvasilenko Jan 21, 2026
89941b8
update docs
bvasilenko Jan 21, 2026
8293a16
fix nested `if` preprocessing
bvasilenko Jan 18, 2026
1d0a58f
add `for` loop support
bvasilenko Jan 19, 2026
89dbf2f
add `for` loop codegen and strategy.close() next-bar execution
bvasilenko Jan 21, 2026
63b6e01
add complete AST traversal for arrow function call detection
bvasilenko Jan 21, 2026
db1de04
fix Pine := reassignment operator generates correct Go = instead of :=
bvasilenko Jan 21, 2026
5a32140
fix series variable argument resolution
bvasilenko Jan 21, 2026
b5704a3
fix user-defined function context allocation in conditions
bvasilenko Jan 21, 2026
9960223
fix after rebase
bvasilenko Jan 21, 2026
8b7d401
update rsi golden tests after rebase
bvasilenko Jan 21, 2026
c714d1d
update pineGenPath
bvasilenko Jan 22, 2026
3aef592
fix user-defined function calls in binary expressions generate proper…
bvasilenko Jan 22, 2026
d9f0791
fix user-defined function calls in binary expressions generate proper…
bvasilenko Jan 22, 2026
32eff82
unskip bb-rsi strategy
bvasilenko Jan 22, 2026
bf5e0cb
cleanup; update docs
bvasilenko Jan 22, 2026
3c1f92f
update docs
bvasilenko Jan 22, 2026
85746b5
fix EMA NaN propagation
bvasilenko Jan 22, 2026
66d6e18
fix missing color constants
bvasilenko Jan 23, 2026
794134b
add tab indentiation preprocessing
bvasilenko Jan 23, 2026
3a6faff
fix TA functions in ternary expressions
bvasilenko Jan 23, 2026
f21294b
update docs
bvasilenko Jan 24, 2026
542c64d
update docs
bvasilenko Jan 26, 2026
9428ab2
fix `input.float` via InputConstantExtractor
bvasilenko Jan 26, 2026
d0f4e96
fix input.string/session constant registration
bvasilenko Jan 27, 2026
4851128
fix strategy.close/close_all/exit when parameter extraction
bvasilenko Jan 27, 2026
3724fc8
update docs
bvasilenko Jan 27, 2026
da2eeed
add ArrowValueFunctionGenerator for nz/na/fixnan in arrow context
bvasilenko Jan 28, 2026
9f3d72c
fix TA functions with single-arg length patterns like highest(2)
bvasilenko Jan 28, 2026
e95c723
add dual-period pivot functions for arrow context
bvasilenko Jan 29, 2026
b974020
fix security() detection in nested conditionals via walker delegation
bvasilenko Jan 29, 2026
030b854
add ta.tr namespace access and tuple indicator routing for arrow context
bvasilenko Jan 29, 2026
a0a23cf
add timeframe.period runtime resolution for security()
bvasilenko Jan 29, 2026
48fcffe
update docs
bvasilenko Jan 30, 2026
492f103
add user variable resolution for security() symbol/timeframe arguments
bvasilenko Jan 30, 2026
03c4c28
add ta.linreg with offset parameter support
bvasilenko Jan 30, 2026
c775fa4
add bar_index historical access support
bvasilenko Jan 30, 2026
6db8645
fix crossover/crossunder constant threshold codegen
bvasilenko Feb 1, 2026
5139fa1
align OHLCV series access to ForwardSeriesBuffer
bvasilenko Feb 1, 2026
996c913
enable Keltner Squeeze golden tests
bvasilenko Feb 1, 2026
511e987
add ticker.heikinashi with security() bar transformation
bvasilenko Feb 1, 2026
ff545ec
add universal TA signature registry with 32 function support
bvasilenko Feb 1, 2026
6e69704
update docs
bvasilenko Feb 1, 2026
20e7347
add iff() to ternary transformer for v4 compatibility
bvasilenko Feb 1, 2026
e07d18c
fix Pine v4 boolean direction in strategy.entry
bvasilenko Feb 1, 2026
402f4fe
add ObjectExpression diagnostic msg
bvasilenko Feb 1, 2026
f5f6705
update docs
bvasilenko Feb 1, 2026
418f5ec
update docs
bvasilenko Feb 2, 2026
6abf666
update docs
bvasilenko Feb 3, 2026
8035872
add number format edge case tests for integers, floats, leading/trail…
bvasilenko Feb 4, 2026
759f3fd
add tests for math functions including basic math, trigonometric, sum…
bvasilenko Feb 4, 2026
fc026fe
add tests for inline function composition and various TA scenarios
bvasilenko Feb 4, 2026
64f5eef
fix lexer Float pattern for scientific notation and decimal variants
bvasilenko Feb 4, 2026
4db300f
add tests for dynamic period edge cases in TA functions
bvasilenko Feb 4, 2026
81a8da8
fix boolean literal type coercion in ternary expressions
bvasilenko Feb 5, 2026
6a459ec
add identifiers for `color` constants
bvasilenko Feb 5, 2026
ccdb422
add for/if expression assignment with IIFE codegen
bvasilenko Feb 5, 2026
1279841
add compile-time constant period evaluation for TA functions
bvasilenko Feb 6, 2026
f0ba876
add math function codegen with facade/strategy pattern
bvasilenko Feb 7, 2026
e842235
add inline comma-separated statements in function bodies
bvasilenko Feb 7, 2026
4c3ec54
update docs
bvasilenko Feb 7, 2026
739ab86
fix math codegen to registry-based dispatch
bvasilenko Feb 8, 2026
b50aec9
update docs
bvasilenko Feb 8, 2026
bb5acf0
fix plot TA hoisting and temp var determinism
bvasilenko Feb 8, 2026
e811e6e
extract inline TA scanning into scanner/classifier/filter
bvasilenko Feb 8, 2026
a1a59cb
add tests for inline TA scanner, classifier, filter and plot composition
bvasilenko Feb 8, 2026
2bbfc35
fix nz/na call routing in arrow function arguments
bvasilenko Feb 8, 2026
de9174b
fix tuple destructuring codegen for security() calls
bvasilenko Feb 8, 2026
9c2546b
add `switch` support
bvasilenko Feb 9, 2026
0b232df
fix TA call codegen in arrow bodies with IIFE generators and unified …
bvasilenko Feb 9, 2026
41479a1
update docs
bvasilenko Feb 9, 2026
e725a9c
update docs
bvasilenko Feb 9, 2026
5a6a773
fix input type inference for named-arg-only calls
bvasilenko Feb 9, 2026
58752cd
fix condition expression identifier resolution for derived builtins
bvasilenko Feb 9, 2026
ad9f3aa
fix arrow function identifier resolution in delegated calls
bvasilenko Feb 10, 2026
65f329e
add security() support in arrow functions
bvasilenko Feb 10, 2026
bc94d44
add AEG completeness, bool coercion, call site numbering fix
bvasilenko Feb 10, 2026
d74b9be
add for-in iteration and break/continue with loop bug fixes
bvasilenko Feb 10, 2026
511ff77
add inline switch case body support
bvasilenko Feb 11, 2026
5b6b7cd
add `while`-loop support
bvasilenko Feb 11, 2026
f737f1f
add var/varip declaration support
bvasilenko Feb 11, 2026
1f54685
add var/varip parser and codegen tests
bvasilenko Feb 11, 2026
5a89ee5
add var/varip integration test fixtures
bvasilenko Feb 11, 2026
ca0e28d
add t.Parallel() to golden and integration tests
bvasilenko Feb 11, 2026
9b6d57b
resolve var/varip blocker in BLOCKERS.md
bvasilenko Feb 11, 2026
c5fdbcb
align generator struct literal formatting
bvasilenko Feb 11, 2026
c7831b9
fix os.Chdir race in syminfo_tickerid_test
bvasilenko Feb 12, 2026
b5277bd
update docs
bvasilenko Feb 12, 2026
526fddc
add time series builtin and namespace resolver for arrow scope
bvasilenko Feb 12, 2026
80ca22e
fix unary negation and if-block variable promotion in codegen
bvasilenko Feb 12, 2026
e4436d6
add calendar builtins, last_bar_index, and dayofweek.* namespace for …
bvasilenko Feb 12, 2026
4fe6584
add expression-position TA dispatch
bvasilenko Feb 13, 2026
1f7aa86
Fix arrow-scope builtin subscript
bvasilenko Feb 13, 2026
06bbd0d
add computed period expression support for arrow function TA calls
bvasilenko Feb 13, 2026
fe81798
add namespace extensions, coercion fix, session/time series lifecycles
bvasilenko Feb 13, 2026
5b86d13
Fix dynamic-period hoisting and per-statement calc emission
bvasilenko Feb 13, 2026
fef2539
Add color.* function codegen, runtime, and golden tests
bvasilenko Feb 13, 2026
934b9e3
Add missing input.* type handlers
bvasilenko Feb 13, 2026
7879f83
Add RSI/ATR dynamic period dispatch with emitter refactor
bvasilenko Feb 14, 2026
dfc644c
Add dynamic period unit and integration tests
bvasilenko Feb 14, 2026
6b719ae
update docs
bvasilenko Feb 14, 2026
0580323
add InputValueKind registry
bvasilenko Feb 14, 2026
4b4c894
add expression-position security dispatch with shared classifier
bvasilenko Feb 14, 2026
96f3362
Add AccessScope enum with arrow builtin access generator
bvasilenko Feb 14, 2026
3f514d6
Add barssince/mfi handlers with hoisting and bare-name fixes
bvasilenko Feb 15, 2026
6dcc4b8
security: add derived price resolution
bvasilenko Feb 15, 2026
7a83dfa
update docs
bvasilenko Feb 15, 2026
7beaf12
Fix ticker.* stub handlers with full arg support
bvasilenko Feb 15, 2026
8efe035
add calendar/timestamp/timeframe codegen, runtime
bvasilenko Feb 15, 2026
3f52a6f
update docs
bvasilenko Feb 16, 2026
3448e4d
Add ta.dmi tuple indicator with ImplicitSources architecture
bvasilenko Feb 16, 2026
8cf8070
Add ta.cum with runtime, codegen, handler, and integration tests
bvasilenko Feb 16, 2026
4e7b60a
Add str.* namespace handler
bvasilenko Feb 16, 2026
6bbdc4f
Add strategy.* scalar variables with runtime aggregators and codegen
bvasilenko Feb 17, 2026
437a569
Add ta.max/min/median/variance/range/mode with accumulators
bvasilenko Feb 17, 2026
a451f8f
Add ta.vwma with volume-weighted accumulator and integration tests
bvasilenko Feb 18, 2026
693bd1e
Add strategy.closedtrades/opentrades accessors with runtime, codegen,…
bvasilenko Feb 18, 2026
ca9971e
Add ta.rising/falling/cross/highestbars/lowestbars/mom/roc/cmo/wpr wi…
bvasilenko Feb 19, 2026
4d91c8e
Expand strategy.* series with drawdown, runup, commission, and histor…
bvasilenko Feb 20, 2026
eb75f42
Add strategy.order/cancel/cancel_all, commission config, direction co…
bvasilenko Feb 28, 2026
a420f9e
Fix strategy.max_drawdown/max_runup intrabar equity calculation and c…
bvasilenko Feb 28, 2026
e5a5523
Align security TA state managers to ForwardSeriesBuffer with historic…
bvasilenko Feb 28, 2026
3da55ee
Add strategy.convert_to_account/convert_to_symbol/default_entry_qty w…
bvasilenko Mar 2, 2026
038d682
Add ta.swma/cci/bbw/cog/tsi with handlers, IIFE generators, dynamic p…
bvasilenko Mar 3, 2026
9d85108
Fix TSI historical lookback bug, remove dead storage artifacts, and a…
bvasilenko Mar 3, 2026
59dc830
Add ta.obv/accdist/pvt/iii/wvad/nvi/pvi/wad volume variables with spe…
bvasilenko Mar 3, 2026
2dd22bb
Add ta.alma/correlation/hma/kcw/percentile/percentrank/sar with handl…
bvasilenko Mar 3, 2026
fc148d4
Fix RSI repeated-bar state corruption in security downscaling with ca…
bvasilenko Mar 3, 2026
1efed73
Add ta.tr/kc/supertrend with tuple handlers, KCW useTrueRange fix, sh…
bvasilenko Mar 4, 2026
414a239
Unify security evaluator initialization across bar-loop, inline, and …
bvasilenko Mar 4, 2026
a59487d
Add ta.pivot_point_levels with ArraySeries paradigm, nil-safe Elem ac…
bvasilenko Mar 4, 2026
b59f4d1
update docs
bvasilenko Mar 4, 2026
b24db5d
Fix composite indicator duplicate emission in ternary branches with T…
bvasilenko Mar 4, 2026
eb55164
update docs
bvasilenko Mar 4, 2026
e4777c9
Fix security TA hoisting duplicate-declaration bug, replace TASeriesS…
bvasilenko Mar 4, 2026
fb8789d
Add 28 security evaluator TA functions (formula/window/math), O(1) Ba…
bvasilenko Mar 5, 2026
323978c
Fix crossover/crossunder historical subscript offset shifting with Se…
bvasilenko Mar 5, 2026
86dc036
Generalize security TA source parameters from *ast.Identifier to ast.…
bvasilenko Mar 5, 2026
e72cbde
Add 22 security evaluator math/scalar builtins (math.*, nz, na, int, …
bvasilenko Mar 6, 2026
92cdfb9
Fix arrow function for-loop scope resolution with 4-category identifi…
bvasilenko Mar 6, 2026
0e5027c
Add OuterScopeCaptureAnalyzer with cross-scope variable injection, st…
bvasilenko Mar 8, 2026
cc1b2c3
Fix bar_index integerSeriesBuiltins codegen with modulo/if-statement …
bvasilenko Mar 19, 2026
240dce6
Add TickerNamespaceTransformer for v4→v5 heikinashi/renko/kagi/linebr…
bvasilenko Mar 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ __pycache__/
*.dylib
bin/
dist/
pine-gen
/pine-gen
/build/pine-gen

# Test binary, built with `go test -c`
*.test
Expand All @@ -203,7 +204,7 @@ vendor/
# Temporary files and build artifacts
tmp/
temp/
output/
/output/

# IDE files
.idea/
Expand All @@ -225,3 +226,7 @@ Thumbs.db
testdata/output.json
testdata/sma-output.json
testdata/*-output.json

# Contribot
contribot.*.json
transcripts/
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Makefile for Runner - PineScript Go Port
# Centralized build automation following Go project conventions

.PHONY: help build test test-unit test-integration test-e2e test-parser test-codegen test-runtime test-series test-syminfo regression-syminfo bench bench-series coverage coverage-show check ci clean clean-all cross-compile fmt vet lint build-strategy
.PHONY: help build test test-unit test-integration test-e2e test-golden test-golden-update test-parser test-codegen test-runtime test-series test-syminfo regression-syminfo bench bench-series coverage coverage-show check ci clean clean-all cross-compile fmt vet lint build-strategy

# Project configuration
PROJECT_NAME := runner
Expand Down Expand Up @@ -104,8 +104,8 @@ _cross_compile_platform:

##@ Testing

# Main test target: runs all tests (unit + integration + e2e)
test: test-unit test-integration test-e2e ## Run all tests (unit + integration + e2e)
# Main test target: runs all tests (unit + integration + e2e + golden)
test: test-unit test-integration test-e2e test-golden ## Run all tests (unit + integration + e2e + golden)
@echo "✓ All tests passed"

test-unit: ## Run unit tests (excludes integration)
Expand All @@ -115,14 +115,24 @@ test-unit: ## Run unit tests (excludes integration)

test-integration: ## Run integration tests
@echo "Running integration tests..."
@ $(GOTEST) $(TEST_FLAGS) -tags=integration ./tests/test-integration/...
@ $(GOTEST) $(TEST_FLAGS) -tags=integration ./tests/integration/...
@echo "✓ Integration tests passed"

test-e2e: ## Run E2E tests (compile + execute all Pine fixtures/strategies)
@echo "Running E2E tests..."
@./scripts/e2e-runner.sh
@echo "✓ E2E tests passed"

test-golden: ## Run golden file regression tests
@echo "Running golden file regression tests..."
@ $(GOTEST) $(TEST_FLAGS) ./tests/golden/...
@echo "✓ Golden tests passed"

test-golden-update: ## Update golden baseline files
@echo "Updating golden baseline files..."
@ $(GOTEST) -v ./tests/golden/... -update-golden
@echo "✓ Golden baselines updated"

test-parser: ## Run parser tests only
@echo "Running parser tests..."
@ $(GOTEST) $(TEST_FLAGS) ./parser/...
Expand Down
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ High-performance PineScript v5 parser, transpiler, and runtime written in Go for

## Tooling

- **pine-inspect**: AST parser/debugger (outputs JSON AST for inspection)
- **pine-gen**: Code generator (transpiles .pine → Go source)
- **Strategy binaries**: Standalone executables (compiled per-strategy)

Expand All @@ -20,7 +19,7 @@ make fetch-strategy SYMBOL=BTCUSDT TIMEFRAME=1h BARS=500 STRATEGY=strategies/dai
make serve-strategy SYMBOL=AAPL TIMEFRAME=1D BARS=200 STRATEGY=strategies/test-simple.pine

# Run with pre-generated data file (deterministic, CI-friendly)
make run-strategy STRATEGY=strategies/daily-lines.pine DATA=golang-port/testdata/ohlcv/BTCUSDT_1h.json
make run-strategy STRATEGY=strategies/daily-lines.pine DATA=tests/fixtures/ohlcv/BTCUSDT_1h.json
```

### Build Commands
Expand Down Expand Up @@ -58,7 +57,7 @@ make fetch-strategy SYMBOL=SBER TIMEFRAME=1h BARS=500 STRATEGY=strategies/ema-st
# Reproducible test (no network)
make run-strategy \
STRATEGY=strategies/test-simple.pine \
DATA=testdata/ohlcv/BTCUSDT_1h.json
DATA=tests/fixtures/ohlcv/BTCUSDT_1h.json
```

### Building Standalone Binaries
Expand Down Expand Up @@ -134,7 +133,7 @@ make coverage-show # Opens in browser
# Run strategy with existing data
make run-strategy \
STRATEGY=strategies/daily-lines.pine \
DATA=golang-port/testdata/ohlcv/BTCUSDT_1h.json
DATA=tests/fixtures/ohlcv/BTCUSDT_1h.json

# Fetch live data and run strategy
make fetch-strategy \
Expand Down Expand Up @@ -193,10 +192,10 @@ make bench-series

# 5. Build a strategy and test it
make build-strategy STRATEGY=strategies/test-simple.pine OUTPUT=test-runner
./golang-port/build/test-runner \
./build/test-runner \
-symbol BTCUSDT \
-timeframe 1h \
-data golang-port/testdata/ohlcv/BTCUSDT_1h.json \
-data tests/fixtures/ohlcv/BTCUSDT_1h.json \
-output out/test-result.json

# 6. View results
Expand All @@ -216,23 +215,18 @@ make ci

```bash
# Verbose test output
cd golang-port
go test -v ./tests/integration/

# Test specific function
cd golang-port
go test -v ./tests/integration -run TestSecurity

# Check for race conditions
cd golang-port
go test -race -count=10 ./...

# Benchmark specific package
cd golang-port
go test -bench=. -benchmem -benchtime=5s ./runtime/series/

# Memory profiling
cd golang-port
go test -memprofile=mem.prof -bench=. ./runtime/series/
go tool pprof mem.prof
```
Expand Down
58 changes: 55 additions & 3 deletions ast/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,26 @@ const (
TypeProperty NodeType = "Property"
TypeBinaryExpression NodeType = "BinaryExpression"
TypeIfStatement NodeType = "IfStatement"
TypeForStatement NodeType = "ForStatement"
TypeForInStatement NodeType = "ForInStatement"
TypeWhileStatement NodeType = "WhileStatement"
TypeConditionalExpression NodeType = "ConditionalExpression"
TypeLogicalExpression NodeType = "LogicalExpression"
TypeUnaryExpression NodeType = "UnaryExpression"
TypeArrayPattern NodeType = "ArrayPattern"
TypeArrowFunctionExpression NodeType = "ArrowFunctionExpression"
TypeBreakStatement NodeType = "BreakStatement"
TypeContinueStatement NodeType = "ContinueStatement"
)

type Node interface {
Type() NodeType
}

type Program struct {
NodeType NodeType `json:"type"`
Body []Node `json:"body"`
NodeType NodeType `json:"type"`
Body []Node `json:"body"`
PineVersion int `json:"pineVersion,omitempty"`
}

func (p *Program) Type() NodeType { return TypeProgram }
Expand Down Expand Up @@ -58,6 +64,7 @@ type VariableDeclaration struct {
NodeType NodeType `json:"type"`
Declarations []VariableDeclarator `json:"declarations"`
Kind string `json:"kind"`
Persistence string `json:"persistence,omitempty"` // "", "var", "varip"
}

func (v *VariableDeclaration) Type() NodeType { return TypeVariableDeclaration }
Expand Down Expand Up @@ -149,7 +156,40 @@ type IfStatement struct {
Alternate []Node `json:"alternate,omitempty"`
}

func (i *IfStatement) Type() NodeType { return TypeIfStatement }
func (i *IfStatement) Type() NodeType { return TypeIfStatement }
func (i *IfStatement) expressionNode() {}

type ForStatement struct {
NodeType NodeType `json:"type"`
Counter string `json:"counter"`
From Expression `json:"from"`
To Expression `json:"to"`
Step Expression `json:"step,omitempty"`
Body []Node `json:"body"`
}

func (f *ForStatement) Type() NodeType { return TypeForStatement }
func (f *ForStatement) expressionNode() {}

type ForInStatement struct {
NodeType NodeType `json:"type"`
IndexVar string `json:"indexVar,omitempty"`
ElementVar string `json:"elementVar"`
Collection Expression `json:"collection"`
Body []Node `json:"body"`
}

func (f *ForInStatement) Type() NodeType { return TypeForInStatement }
func (f *ForInStatement) expressionNode() {}

type WhileStatement struct {
NodeType NodeType `json:"type"`
Condition Expression `json:"condition"`
Body []Node `json:"body"`
}

func (w *WhileStatement) Type() NodeType { return TypeWhileStatement }
func (w *WhileStatement) expressionNode() {}

type ConditionalExpression struct {
NodeType NodeType `json:"type"`
Expand Down Expand Up @@ -189,3 +229,15 @@ type ArrowFunctionExpression struct {

func (a *ArrowFunctionExpression) Type() NodeType { return TypeArrowFunctionExpression }
func (a *ArrowFunctionExpression) expressionNode() {}

type BreakStatement struct {
NodeType NodeType `json:"type"`
}

func (b *BreakStatement) Type() NodeType { return TypeBreakStatement }

type ContinueStatement struct {
NodeType NodeType `json:"type"`
}

func (c *ContinueStatement) Type() NodeType { return TypeContinueStatement }
58 changes: 0 additions & 58 deletions cmd/debug-ast/main.go

This file was deleted.

48 changes: 0 additions & 48 deletions cmd/debug-bb7-args/main.go

This file was deleted.

Loading
Loading