WolframResearch / codeparser

Parse Wolfram Language source code as abstract syntax trees (ASTs) or concrete syntax trees (CSTs)
MIT License
123 stars 14 forks source link

Are ToExpression::sntx warnings ok for CodeParse to issue? #11

Closed arnoudbuzing closed 4 years ago

arnoudbuzing commented 4 years ago

Not sure if this is an obscure failure for CodeParse, or if CodeParse can legitimately issue ToExpression warnings:

PS C:\Users\Arnoud> & 'C:\Program Files\Wolfram Research\Mathematica\12.1\wolfram.exe'
Mathematica 12.1.0 Kernel for Microsoft Windows (64-bit)
Copyright 1988-2020 Wolfram Research, Inc.

In[1]:= Needs["CodeParser`"]                                                                                                 
In[2]:= CodeParse["<<[\"]"]                                                                                                  
ToExpression::sntx: Invalid syntax in or before ""["]"".
                                                     ^

Out[2]= ContainerNode[String, {CallNode[LeafNode[Symbol, Get, <||>], {LeafNode[Symbol, $Failed, <||>]},

>      <|Source -> {{1, 1}, {1, 6}}|>]}, <||>]
bostick commented 4 years ago

This is a good catch!

I was escaping other characters so that something like this was fine to do:

<<[\b\f\n\r\t]

but was not handling double quote.

Addressed in https://github.com/WolframResearch/codeparser/pull/15

bostick commented 4 years ago

Obscure failures are CodeParser's currency