Skip to content

use ast.FileScan of stdin instead of ast.DefaultScan#7040

Open
nwt wants to merge 1 commit into
mainfrom
FileScan-instead-of-DeafultScan
Open

use ast.FileScan of stdin instead of ast.DefaultScan#7040
nwt wants to merge 1 commit into
mainfrom
FileScan-instead-of-DeafultScan

Conversation

@nwt
Copy link
Copy Markdown
Member

@nwt nwt commented Jun 6, 2026

When its extInput parameter is true, compiler/semantic.Analyze prepends an ast.DefaultScan to the AST. Change it to prepend an ast.FileScan for standard input instead.

To allow that FileScan to access sio.Readers passed to compiler.CompileWithAST, add a new runtime/exec.Environment.Stdin field, set the field in CompileWithAST if the length of the readers paramter is nonzero, and return a scanner for it in Environment.Open if the field is set when opening standard input.

When its extInput parameter is true, compiler/semantic.Analyze prepends
an ast.DefaultScan to the AST.  Change it to prepend an ast.FileScan for
standard input instead.

To allow that FileScan to access sio.Readers passed to
compiler.CompileWithAST, add a new runtime/exec.Environment.Stdin field,
set the field in CompileWithAST if the length of the readers paramter is
nonzero, and return a scanner for it in Environment.Open if the field is
set when opening standard input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants