Hi Ian,
The following snippet should get you started:
| error sourceCode ast | error := nil. sourceCode := '3 + 4. 5'. ast := [ Parser new parse: sourceCode class: UndefinedObject noPattern: true notifying: nil ifFail: nil ] on: SyntaxErrorNotification do: [ :e | error := e ]. error ifNil: [ ast explore ] ifNotNil: [ error explore ]
Levente
On Tue, 25 Apr 2017, Ian Trudel wrote:
Hello! I would like to determine whether some text (both single and multiple liners) sent over network is syntactically valid. Using Parser contains the relevant information but would need a true/false answer. Also knowing what the code is (literal, block, temporaries, method, etc) would be a nice bonus. Maybe get some error message too.
How would you accomplish this?
Best regards, Ian