mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 14:18:42 +01:00
Reorganize the compiler to be bottom-up.
Gets rid of a bunch of forward declarations and shortens the code. Also makes points of recursion more explicit.
This commit is contained in:
3
metrics
3
metrics
@ -11,11 +11,13 @@ num_docs = 0
|
||||
num_code = 0
|
||||
num_empty = 0
|
||||
num_todos = 0
|
||||
num_semicolons = 0
|
||||
|
||||
for source_path in glob.iglob("src/*.[ch]"):
|
||||
num_files += 1
|
||||
with open(source_path, "r") as input:
|
||||
for line in input:
|
||||
num_semicolons += line.count(';')
|
||||
match = TODO_PATTERN.match(line)
|
||||
if match:
|
||||
num_todos += 1
|
||||
@ -37,3 +39,4 @@ print num_todos, "TODOs"
|
||||
print num_docs, "comment lines"
|
||||
print num_code, "code lines"
|
||||
print num_empty, "empty lines"
|
||||
print num_semicolons, "semicolons"
|
||||
|
||||
1442
src/compiler.c
1442
src/compiler.c
File diff suppressed because it is too large
Load Diff
23
test/bool_equality.wren
Normal file
23
test/bool_equality.wren
Normal file
@ -0,0 +1,23 @@
|
||||
io.write(true == true) // expect: true
|
||||
io.write(true == false) // expect: false
|
||||
io.write(false == true) // expect: false
|
||||
io.write(false == false) // expect: true
|
||||
|
||||
// Not equal to other types.
|
||||
io.write(true == 1) // expect: false
|
||||
io.write(false == 0) // expect: false
|
||||
io.write(true == "true") // expect: false
|
||||
io.write(false == "false") // expect: false
|
||||
io.write(false == "") // expect: false
|
||||
|
||||
io.write(true != true) // expect: false
|
||||
io.write(true != false) // expect: true
|
||||
io.write(false != true) // expect: true
|
||||
io.write(false != false) // expect: false
|
||||
|
||||
// Not equal to other types.
|
||||
io.write(true != 1) // expect: true
|
||||
io.write(false != 0) // expect: true
|
||||
io.write(true != "true") // expect: true
|
||||
io.write(false != "false") // expect: true
|
||||
io.write(false != "") // expect: true
|
||||
Reference in New Issue
Block a user