Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
d56a9a1c
Commit
d56a9a1c
authored
Dec 06, 2015
by
Radim Marek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct position of the newly imported tokens
parent
d1216f40
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
caddy/parse/parsing.go
caddy/parse/parsing.go
+12
-4
No files found.
caddy/parse/parsing.go
View file @
d56a9a1c
...
...
@@ -198,12 +198,23 @@ func (p *parser) doImport() error {
return
p
.
Errf
(
"No files matching the import pattern %s"
,
importPattern
)
}
// Splice out the import directive and its argument (2 tokens total)
// and insert the imported tokens in their place.
tokensBefore
:=
p
.
tokens
[
:
p
.
cursor
-
1
]
tokensAfter
:=
p
.
tokens
[
p
.
cursor
+
1
:
]
// cursor was advanced one position to read filename; rewind it
p
.
cursor
--
p
.
tokens
=
tokensBefore
for
_
,
importFile
:=
range
matches
{
if
err
:=
p
.
doSingleImport
(
importFile
);
err
!=
nil
{
return
err
}
}
p
.
tokens
=
append
(
p
.
tokens
,
append
(
tokensAfter
)
...
)
return
nil
}
...
...
@@ -222,10 +233,7 @@ func (p *parser) doSingleImport(importFile string) error {
// Splice out the import directive and its argument (2 tokens total)
// and insert the imported tokens in their place.
tokensBefore
:=
p
.
tokens
[
:
p
.
cursor
-
1
]
tokensAfter
:=
p
.
tokens
[
p
.
cursor
+
1
:
]
p
.
tokens
=
append
(
tokensBefore
,
append
(
importedTokens
,
tokensAfter
...
)
...
)
p
.
cursor
--
// cursor was advanced one position to read the filename; rewind it
p
.
tokens
=
append
(
p
.
tokens
,
append
(
importedTokens
)
...
)
return
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment