Skip to content

Commit df970d2

Browse files
committed
Inherit properties set via Source
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
1 parent df8caf7 commit df970d2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

parser/parser.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ func (p *Parser) Parse() []Command {
123123
p.nextToken()
124124
continue
125125
}
126-
cmds = append(cmds, p.parseCommand())
126+
cmds = append(cmds, p.parseCommand(cmds))
127127
p.nextToken()
128128
}
129129

130130
return cmds
131131
}
132132

133133
// parseCommand parses a command.
134-
func (p *Parser) parseCommand() Command {
134+
func (p *Parser) parseCommand(cmds []Command) Command {
135135
switch p.cur.Type {
136136
case token.SPACE,
137137
token.BACKSPACE,
@@ -170,7 +170,7 @@ func (p *Parser) parseCommand() Command {
170170
case token.WAIT:
171171
return p.parseWait()
172172
case token.SOURCE:
173-
return p.parseSource()
173+
return p.parseSource(cmds)
174174
case token.SCREENSHOT:
175175
return p.parseScreenshot()
176176
case token.COPY:
@@ -652,7 +652,7 @@ func (p *Parser) parseEnv() Command {
652652
// Source command takes a tape path to include in current tape.
653653
//
654654
// Source <path>
655-
func (p *Parser) parseSource() Command {
655+
func (p *Parser) parseSource(cmds []Command) Command {
656656
cmd := Command{Type: token.SOURCE}
657657

658658
if p.peek.Type != token.STRING {
@@ -718,6 +718,10 @@ func (p *Parser) parseSource() Command {
718718
return cmd
719719
}
720720

721+
722+
for _, cmd := range srcCmds {
723+
cmds = append(cmds, cmd)
724+
}
721725
cmd.Args = p.peek.Literal
722726
p.nextToken()
723727
return cmd

0 commit comments

Comments
 (0)