go/src/cmd/compile/internal/syntax
Robert Griesemer ac45cb9aa0 cmd/compile/internal/syntax: permit /*line file:line:col*/ directives
R=go1.11

This implements parsing of /*line file:line*/ and /*line file:line:col*/
directives and also extends the optional column format to regular //line
directives, per #22662.

For a line directive to be recognized, its comment text must start with
the prefix "line " which is followed by one of the following:

:line
:line:col
filename:line
filename:line:col

with at least one : present. The line and col values must be unsigned
decimal integers; everything before is considered part of the filename.

Valid line directives are:

//line :123
//line :123:8
//line foo.go:123
//line C:foo.go:123	(filename is "C:foo.go")
//line C:foo.go:123:8	(filename is "C:foo.go")
/*line ::123*/		(filename is ":")

No matter the comment format, at the moment all directives act as if
they were in //line comments, and column information is ignored.
To be addressed in subsequent CLs.

For #22662.

Change-Id: I1a2dc54bacc94bc6cdedc5229ee13278971f314e
Reviewed-on: https://go-review.googlesource.com/86037
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2018-02-12 22:57:52 +00:00
..
branches.go all: fix easy-to-miss typos 2017-08-23 03:07:12 +00:00
dumper.go cmd/compile/internal/syntax: print position info for names in tree dump 2017-03-06 23:45:14 +00:00
dumper_test.go cmd/compile/internal/syntax: compute BranchStmt.Target statements 2017-04-21 22:30:55 +00:00
nodes.go cmd/compile/internal/syntax: compute BranchStmt.Target statements 2017-04-21 22:30:55 +00:00
nodes_test.go cmd/compile/internal/syntax: remove ParseBytes from API - not needed 2018-02-12 22:57:49 +00:00
parser.go cmd/compile/internal/syntax: permit /*line file:line:col*/ directives 2018-02-12 22:57:52 +00:00
parser_test.go cmd/compile/internal/syntax: permit /*line file:line:col*/ directives 2018-02-12 22:57:52 +00:00
printer.go cmd/compile/internal/syntax: always construct a correct syntax tree 2017-03-25 21:01:49 +00:00
printer_test.go cmd/compile/internal/syntax: remove ParseBytes from API - not needed 2018-02-12 22:57:49 +00:00
scanner.go cmd/compile/internal/syntax: permit /*line file:line:col*/ directives 2018-02-12 22:57:52 +00:00
scanner_test.go cmd/compile/internal/syntax: permit /*line file:line:col*/ directives 2018-02-12 22:57:52 +00:00
source.go cmd/compile/internal/syntax: fix source buffer refilling 2017-09-20 17:47:26 +00:00
syntax.go cmd/compile/internal/syntax: remove ParseBytes from API - not needed 2018-02-12 22:57:49 +00:00
tokens.go cmd/compile/internal/syntax: fix 'delimiters' spelling 2017-08-14 14:13:22 +00:00