-
Notifications
You must be signed in to change notification settings - Fork 0
Repo Analysis
This page walks through how Crodox parses the Test_Repo using the Basics grammar. It shows the object trees Crodox builds, how variables resolve, and how cross-file dependencies form.
Work in progress: This analysis is based on the Basics grammar, which is not complete. It is a starting point meant to be extended and adapted to your needs.
The grammar starts with:
<~"FROM".txt~>
Crodox scans the repository and matches all .txt files. Each file gets a path variable FROM storing its relative path:
| File |
FROM value |
|---|---|
testFile.txt |
./testFile |
bridgeTest2.txt |
./bridgeTest2 |
refFile.txt |
./refFile |
folder/bridgeTest.txt |
./folder/bridgeTest |
Crodox parses each file and builds a tree of recognized objects.
FILE (FROM = ./testFile)
|- import name = C2 (:up) FROM = ./bridgeTest2
|- import name = F5 (:up) FROM = ./folder/bridgeTest
|- variable NAME = aaa
|- variable NAME = bbb
|- variable NAME = ccc
|- class NAME = C1 (:up) params: a, b, c (:down)
| |- variable NAME = hhh
| |- variable NAME = zzz
| |- function NAME = F1 (:up) param: V1 (:down)
| | |- variable NAME = xxx ref = 'zzz'
| | |- variable NAME = yyy
| |- function NAME = F2 (:up) param: V2 (:down)
| |- variable NAME = zzz ref = 'bbb'
| |- variable NAME = yyy ref = 'hhh'
|- refference 'C1' . ![class|function] F1 ( 'aaa' )
|- refference 'C1' . ![class|function] F2 ( 'ccc' )
|- refference 'C2' . ![class|function] F3 ( )
|- refference 'C2' . ![class|function] F4 ( )
FILE (FROM = ./bridgeTest2)
|- class NAME = C2 (:up) params: (none)
| |- variable NAME = ddd
| |- variable NAME = eee
| |- function NAME = F3 (:up) param: Q3 (:down)
| | |- variable NAME = ccc
| | |- variable NAME = ddd
| |- function NAME = F4 (:up) params: eee, aaa, bbb (:down)
| |- variable NAME = xxx ref = 'ddd'
| |- variable NAME = yyy ref = 'eee'
Note:
F2();at the end ofbridgeTest2.txtdoes not match therefferenceobject pattern (<<'name'>> . <<![class|function]name!>>) because there is no dot. Crodox will skip this line during parsing.
FILE (FROM = ./folder/bridgeTest)
|- import name = C3 (:up) FROM = ./refFile
|- function NAME = F5 (:up) params: (none)
|- variable NAME = ccc
|- variable NAME = ddd
FILE (FROM = ./refFile)
|- class NAME = C3 (:up) params: (none)
The comment lines inside
C3are plain text. The Basics grammar has nocommentobject, so Crodox does not parse them. To capture comments, you would add a jump instruction (see Jump Instructions).
Reference variables (<<'name'>>) create dependencies. Crodox resolves each reference by searching upward through the scope tree.
| Reference | Search path | Resolves to |
|---|---|---|
'zzz' in let xxx = zzz
|
F1 scope -> C1 scope |
variable zzz in C1 |
| Reference | Search path | Resolves to |
|---|---|---|
'bbb' in let zzz = bbb
|
F2 scope -> C1 scope -> file scope |
variable bbb at file level |
'hhh' in let yyy = hhh
|
F2 scope -> C1 scope |
variable hhh in C1 |
| Reference | Resolves to |
|---|---|
'C1' |
class C1 (same file, :up scope) |
![class|function] F1 |
function F1 inside C1 (dependency selection limits to class or function types) |
![class|function] F2 |
function F2 inside C1 |
'aaa' |
variable aaa at file level |
'ccc' |
variable ccc at file level |
'C2' |
import C2 (same file, :up scope) - which links to bridgeTest2.txt |
![class|function] F3 |
function F3 inside C2 in bridgeTest2.txt |
![class|function] F4 |
function F4 inside C2 in bridgeTest2.txt |
| Reference | Search path | Resolves to |
|---|---|---|
'ddd' in let xxx = ddd
|
F4 scope -> C2 scope |
variable ddd in C2 |
'eee' in let yyy = eee
|
F4 scope (param) |
parameter eee of F4 (:down) |
'eee'resolves to the parametereee(:downscope) because:downparameters are visible inside the function body. The class-levelvariable eeeis shadowed.
Path variables (<<"FROM".txt>>) in import objects create links between files.
testFile.txt
|- imports C2 from ----> bridgeTest2.txt
|- imports F5 from ----> folder/bridgeTest.txt
|- imports C3 from ----> refFile.txt
- The
importobject matchesfrom './bridgeTest2.txt' -
<<"FROM".txt>>extracts the path./bridgeTest2 - Crodox looks for a file where the
FROMpath variable equals./bridgeTest2 -
bridgeTest2.txtmatches - the files are now linked - The imported name
C2(:upscope) becomes visible intestFile.txt - References to
C2intestFile.txtcan now resolve intobridgeTest2.txt
graph LR
subgraph testFile.txt
imp1[import C2]
imp2[import F5]
aaa[var aaa]
bbb[var bbb]
ccc[var ccc]
C1[class C1]
F1[function F1]
F2[function F2]
ref1[C1.F1]
ref2[C1.F2]
ref3[C2.F3]
ref4[C2.F4]
end
subgraph bridgeTest2.txt
C2[class C2]
F3[function F3]
F4[function F4]
end
subgraph folder/bridgeTest.txt
impC3[import C3]
F5[function F5]
end
subgraph refFile.txt
C3[class C3]
end
imp1 -->|path| C2
imp2 -->|path| F5
impC3 -->|path| C3
ref1 -->|ref| C1
ref1 -->|dep select| F1
ref1 -->|ref| aaa
ref2 -->|ref| C1
ref2 -->|dep select| F2
ref2 -->|ref| ccc
ref3 -->|ref| C2
ref3 -->|dep select| F3
ref4 -->|ref| C2
ref4 -->|dep select| F4
- Getting Started
- Sign-Up
- Home Screen
- Creating Your First Template
- Template Editor
- Application Navigation
- Syntax Overview
- Workflow: End-to-End
- Workflow: Test with simpleDemo
- Workflow: Build Template from angularTemp
- Demo Repositories
- Template
- Workbench
- GitHub Integration
- GitHub App Installation
- GitHub Repository Setup
- GitHub Re-linking
- Settings
- Overview
- Declarations
- Types
- Scoping