This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This implementation is based on CollisionShapes and RayCasts. | |
# It has one major flaw: It detects intersections of different lines and not only of the line itself. | |
# I'm pretty sure this can be circumvented by changing the collision_layers of each line | |
# or by keeping track of each line and then excluding their collision_bodies when ray casting | |
# or by removing all the collision bodies when intersection_scanning is done | |
extends Line2D | |
var intersections = [] # Keep track of every intersection | |
var segments = [] # Keep track of every segment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// lisp interpreter | |
// for nodejs-v5: node --es_staging lisp.js | |
"use strict"; | |
function tokenize(code) { | |
const comment = /;.*$/gm; | |
const token = /\(|\)|'|,@?|`|"(?:[^"]|\\")*"|[^\s"'`,\(\)]+/g; | |
return code.replace(comment, "").match(token) || []; | |
} | |
function parse(tokens, depth, tree) { |