Skip to content
This repository was archived by the owner on Sep 20, 2021. It is now read-only.
This repository was archived by the owner on Sep 20, 2021. It is now read-only.

Decimals without a leading integer cause errors #57

Description

@BillBuilt

Example:
$expression = '.35 + .65';
$ast = $compiler->parse($expression);
echo $visitor->visit($ast);

Result:
Uncaught Hoa\Compiler\Exception\UnrecognizedToken, code: 0
Message: Unrecognized token "." at line 1 and column 1: .35 + .65 ↑
File: /web/htdocs/lmifirearms/vendor/hoa/compiler/Llk/Lexer.php
Line: 1

BUT

$expression = '0.35 + 0.65';
$ast = $compiler->parse($expression);
echo $visitor->visit($ast);

Works fine.

This is problematic if evaluating formulas entered by end users, which I am ;-).
Thanks


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions