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
nexedi
caddy
Commits
eae02402
Commit
eae02402
authored
Jan 21, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parser fixes, and now using base filename
parent
decfda27
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
6 deletions
+22
-6
config/config.go
config/config.go
+6
-1
config/directives.go
config/directives.go
+6
-2
config/parser.go
config/parser.go
+9
-3
config/parsing.go
config/parsing.go
+1
-0
No files found.
config/config.go
View file @
eae02402
...
...
@@ -24,7 +24,12 @@ func Load(filename string) ([]Config, error) {
return
nil
,
err
}
defer
file
.
Close
()
p
:=
newParser
(
file
)
p
,
err
:=
newParser
(
file
)
if
err
!=
nil
{
return
nil
,
err
}
return
p
.
parse
()
}
...
...
config/directives.go
View file @
eae02402
...
...
@@ -28,12 +28,16 @@ func init() {
return
p
.
argErr
()
}
file
,
err
:=
os
.
Open
(
p
.
tkn
())
filename
:=
p
.
tkn
()
file
,
err
:=
os
.
Open
(
filename
)
if
err
!=
nil
{
return
p
.
err
(
"Parse"
,
err
.
Error
())
}
defer
file
.
Close
()
p2
:=
newParser
(
file
)
p2
,
err
:=
newParser
(
file
)
if
err
!=
nil
{
return
p
.
err
(
"Parse"
,
"Could not import "
+
filename
+
"; "
+
err
.
Error
())
}
p2
.
cfg
=
p
.
cfg
err
=
p2
.
directives
()
...
...
config/parser.go
View file @
eae02402
...
...
@@ -20,10 +20,16 @@ type parser struct {
// newParser makes a new parser and prepares it for parsing, given
// the input to parse.
func
newParser
(
file
*
os
.
File
)
*
parser
{
p
:=
&
parser
{
filename
:
file
.
Name
()}
func
newParser
(
file
*
os
.
File
)
(
*
parser
,
error
)
{
stat
,
err
:=
file
.
Stat
()
if
err
!=
nil
{
return
nil
,
err
}
p
:=
&
parser
{
filename
:
stat
.
Name
()}
p
.
lexer
.
load
(
file
)
return
p
return
p
,
nil
}
// Parse parses the configuration file. It produces a slice of Config
...
...
config/parsing.go
View file @
eae02402
...
...
@@ -45,6 +45,7 @@ func (p *parser) addressBlock() error {
err
:=
p
.
openCurlyBrace
()
if
err
!=
nil
{
// meh, single-server configs don't need curly braces
p
.
unused
=
true
// we read the token but aren't consuming it
return
p
.
directives
()
}
...
...
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