Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ exports[`examples > fibonacci.plz --input="not a number" > stderr 1`] = `
`;

exports[`examples > fibonacci.plz --input="not a number" > stdout 1`] = `
"input must be a natural number"
"--input must be a natural number"

`;

Expand All @@ -12,7 +12,7 @@ exports[`examples > fibonacci.plz --input=-1 > stderr 1`] = `
`;

exports[`examples > fibonacci.plz --input=-1 > stdout 1`] = `
"input must be a natural number"
"--input must be a natural number"

`;

Expand Down Expand Up @@ -57,7 +57,7 @@ exports[`examples > fibonacci.plz > stderr 1`] = `
`;

exports[`examples > fibonacci.plz > stdout 1`] = `
"missing input argument"
"missing --input argument"

`;

Expand Down
9 changes: 5 additions & 4 deletions examples/fibonacci.plz
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
fibonacci: n =>
@if {
condition: :n < 2
:n < 2
then: :n
else: :fibonacci(:n - 1) + :fibonacci(:n - 2)
}

input: @runtime { context =>
// read --input from command-line arguments
:context.arguments.lookup(input)
}

output: :input match {
none: _ => "missing input argument"
none: _ => "missing --input argument"
some: input => @if {
condition: :natural_number.is(:input)
:natural_number.is(:input)
then: :fibonacci(:input)
else: "input must be a natural number"
else: "--input must be a natural number"
}
}
}.output
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"type": "module",
"bin": {
"please": "./please"
"please": "please"
},
"scripts": {
"0": "node ./dist/language/cli/0.js",
Expand Down
6 changes: 3 additions & 3 deletions src/language/parsing/atom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
zeroOrMore,
} from '@matt.kantor/parsing'
import {
arrow,
atSign,
backslash,
closingBlockCommentDelimiter,
Expand All @@ -32,6 +33,7 @@ import { whitespace } from './trivia.js'
export type Atom = string

const atomComponentsRequiringQuotation = [
arrow,
atSign,
backslash,
closingBlockCommentDelimiter,
Expand All @@ -46,10 +48,8 @@ const atomComponentsRequiringQuotation = [
singleLineCommentDelimiter,
whitespace,

// Reserved to allow symbols like `=>` to not be conflated with atoms:
literal('='),

// Reserved for future use:
literal('='),
literal('['),
literal(']'),
literal('#'),
Expand Down