nwops / puppet-debugger

A interactive live debugger and REPL for the puppet language
https://gitlab.com/puppet-debugger/puppet-debugger
MIT License
121 stars 11 forks source link

using the `.` operator fails due to ability to look back #36

Open logicminds opened 8 years ago

logicminds commented 8 years ago

When the . operator is used to signify that the result of the previous line the repl does not seem to be aware of the previous operation so puppet concludes the code is a syntax error.

Example:

1:>> $var1 = [1,2,3,4]
 => [
  [0] 1,
  [1] 2,
  [2] 3,
  [3] 4
]
2:>> .map | $num | {  notice($num) }
 => Syntax error at '.' at line 1:1

This is happening because the parser that checks for multiline is not aware of the scope.

logicminds commented 8 years ago

issue is here: https://github.com/nwops/puppet-repl/blob/master/lib/puppet-repl/cli.rb#L184