Skip to content

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

Merged
nwt merged 1 commit into
mainfrom
FileScan-instead-of-DeafultScan
Jun 8, 2026
Merged

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

Conversation

@nwt

@nwt nwt commented Jun 6, 2026

Copy link
Copy Markdown
Member

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.
@nwt nwt merged commit ef3aa51 into main Jun 8, 2026
2 checks passed
@nwt nwt deleted the FileScan-instead-of-DeafultScan branch June 8, 2026 12:29
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