Skip to content

Commit

Permalink
don't clog up console (mothertode)
Browse files Browse the repository at this point in the history
  • Loading branch information
TodePond committed Mar 6, 2021
1 parent 5bf8c5d commit 63233cb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions build/habitat-embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ Habitat.install = (global) => {
Habitat.MotherTode = (...args) => {
Term.resetCache()
const source = String.raw(...args)
print(source)
//print(source)
const result = Term.term("MotherTode", Habitat.MotherTode.scope)(source, {exceptions: [], indentSize: 0, scopePath: ""})
if (!result.success) {
//result.log()
Expand All @@ -434,7 +434,7 @@ Habitat.install = (global) => {

const func = new Function(`
const scope = {}
const term = ${result.output.d}
const term = ${result.output}
for (const key in term) {
scope[key] = term[key]
}
Expand Down
4 changes: 2 additions & 2 deletions build/habitat-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ Habitat.install = (global) => {
Habitat.MotherTode = (...args) => {
Term.resetCache()
const source = String.raw(...args)
print(source)
//print(source)
const result = Term.term("MotherTode", Habitat.MotherTode.scope)(source, {exceptions: [], indentSize: 0, scopePath: ""})
if (!result.success) {
//result.log()
Expand All @@ -434,7 +434,7 @@ Habitat.install = (global) => {

const func = new Function(`
const scope = {}
const term = ${result.output.d}
const term = ${result.output}
for (const key in term) {
scope[key] = term[key]
}
Expand Down
4 changes: 2 additions & 2 deletions source/mothertode.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Habitat.MotherTode = (...args) => {
Term.resetCache()
const source = String.raw(...args)
print(source)
//print(source)
const result = Term.term("MotherTode", Habitat.MotherTode.scope)(source, {exceptions: [], indentSize: 0, scopePath: ""})
if (!result.success) {
//result.log()
Expand All @@ -17,7 +17,7 @@

const func = new Function(`
const scope = {}
const term = ${result.output.d}
const term = ${result.output}
for (const key in term) {
scope[key] = term[key]
}
Expand Down
14 changes: 8 additions & 6 deletions tinker/tinker.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,6 @@ const nohi = MotherTode `<"hello" "hi"> ~ "hi" "yo"`
nohi("helloyo").log()
nohi("hiyo").log() //TODO: should fail

// Removed from language
/*const anyhi = MotherTode `any "hi"`
anyhi("hi").log()*/

const match = MotherTode `:: "hi" "ya" >> "Hello world!"`
match("hiyalol").log().output.d

Expand All @@ -309,11 +305,11 @@ const matchs = MotherTode `:: "hi" "ya" >> () => {
}`
matchs("hiyalol").log().output.d

/*const long = MotherTode `
const long = MotherTode `
:: "Hey"
:: "yo" "lol" (:: "bop")
`
long("Heyyololbop").log()*/
long("Heyyololbop").log()

const checker = MotherTode `:: /[a-zA-Z]/+ ?? (name) => name.output == "Luke"`
//checker("Bob").log() //should fail
Expand Down Expand Up @@ -380,3 +376,9 @@ fullWorldScope.Greeting.Hello("hello").log()
fullWorldScope("helloworld.").log()
fullWorldScope.Greeting("hellopond!").log()
fullWorldScope.Greeting.World("pond").log()

const whitespace = MotherTode `
Hello :: "hello"
Name :: /[a-z]/+
`.log()

0 comments on commit 63233cb

Please sign in to comment.