HaxeFoundation / HaxeFoundation/haxe
[feature request] Context.parseSingleExpr
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
#6475 made me think of this again. I would like a function like this:
```haxe
static function parseSingleExpr(s:String, pos:Position):Expr;
```
The difference is that not the whole string is expected to be an expression, but only so much is consumed, until the expression is terminated (essentially what hscript's parseExpr does as opposed to parseFullExpr). So I can call it on e.g. `a.b)blargh` and it will return `a.b` while I can use the `pos.max - pos.min` of the returned expression to know how much of the string was not consumed (or we could return `{ expr: Expr, rest:String }`). It would greatly facilitate picking out Haxe code embedded into other languages.
Contributor guide
Assessment
This issue has not been assessed yet.