evaluate booleans
This commit is contained in:
parent
9d1bd0d489
commit
2f77b3fb5a
@ -1,5 +1,4 @@
|
||||
import type { Identifier } from '@/parser';
|
||||
import { testingLogger } from '@t/logger';
|
||||
|
||||
export type UnionDenotableType =
|
||||
| Array<DenotableType | DenotableFunctionSignature>
|
||||
|
@ -29,6 +29,11 @@ const evaluateValue = (
|
||||
if ('int' in value) {
|
||||
return { type: 'int', value: value.int };
|
||||
}
|
||||
|
||||
if ('bool' in value) {
|
||||
return { type: 'bool', value: value.bool };
|
||||
}
|
||||
|
||||
if ('name' in value) {
|
||||
return env.get(value.name);
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ IntStatement = INT _ int:Integer { return int; }
|
||||
|
||||
RealStatement = REAL _ real:Real { return real; }
|
||||
|
||||
BoolStatement = BOOL _ bool:Integer { return bool; }
|
||||
BoolStatement = BOOL _ bool:Integer { return { bool: bool.int }; }
|
||||
|
||||
StringStatement = STRING _ string:QuotedString { return string; }
|
||||
|
||||
|
@ -2,5 +2,5 @@ export * from './generate';
|
||||
export * from './parser';
|
||||
import * as peggy from './parser';
|
||||
|
||||
export const peggyParse = (source: string): peggy.FunctionDefinition[] =>
|
||||
export const peggyParse = (source: string): peggy.ContinuationExpression[] =>
|
||||
peggy.parse(source);
|
||||
|
@ -512,7 +512,7 @@ function peg$parse(input, options) {
|
||||
return real; };// @ts-ignore
|
||||
|
||||
var peg$f18 = function(bool) {// @ts-ignore
|
||||
return bool; };// @ts-ignore
|
||||
return { bool: bool.int }; };// @ts-ignore
|
||||
|
||||
var peg$f19 = function(string) {// @ts-ignore
|
||||
return string; };// @ts-ignore
|
||||
@ -5395,7 +5395,7 @@ export type VarStatement = Identifier;
|
||||
export type LabelStatement = Identifier;
|
||||
export type IntStatement = Integer;
|
||||
export type RealStatement = Real;
|
||||
export type BoolStatement = Integer;
|
||||
export type BoolStatement = { bool: any };
|
||||
export type StringStatement = QuotedString;
|
||||
export type AccessStatement = OffsetStatement | SelectStatement;
|
||||
export type OffsetStatement = Integer;
|
||||
|
Loading…
Reference in New Issue
Block a user