Merge "Replace bool types with GLboolean." into studio-1.4-dev
diff --git a/api/api.go b/api/api.go
index 2d1f9d6..1492ded 100644
--- a/api/api.go
+++ b/api/api.go
@@ -61,7 +61,7 @@
 	if err != nil {
 		return nil, parse.ErrorList{parse.Error{Message: err.Error()}}
 	}
-	return parser.Parse(string(info))
+	return parser.Parse(path, string(info))
 }
 
 // Resolve resolves the api file with the DefaultProcessor.
diff --git a/api/apic/commands/command.go b/api/apic/commands/command.go
index 59ed20f..627acc4 100644
--- a/api/apic/commands/command.go
+++ b/api/apic/commands/command.go
@@ -95,8 +95,9 @@
 	}
 	for _, e := range errs {
 		if e.At != nil {
+			filename := e.At.Token().Source.Filename
 			line, column := e.At.Token().Cursor()
-			fmt.Fprintf(os.Stderr, "%s:%v:%v: %s\n", apiName, line, column, e.Message)
+			fmt.Fprintf(os.Stderr, "%s:%v:%v: %s\n", filename, line, column, e.Message)
 		} else {
 			fmt.Fprintf(os.Stderr, "%s: %s\n", apiName, e.Message)
 		}
diff --git a/api/apic/format/format.go b/api/apic/format/format.go
index aa3b35c..0fe52ba 100644
--- a/api/apic/format/format.go
+++ b/api/apic/format/format.go
@@ -59,7 +59,7 @@
 			continue
 		}
 
-		api, errs := parser.Parse(string(f))
+		api, errs := parser.Parse(path, string(f))
 		if len(errs) > 0 {
 			fmt.Printf("Errors while parsing '%s':\n", path)
 			for i, e := range errs {
diff --git a/api/apic/validate/no_unreachables_test.go b/api/apic/validate/no_unreachables_test.go
index aeda86e..57cb485 100644
--- a/api/apic/validate/no_unreachables_test.go
+++ b/api/apic/validate/no_unreachables_test.go
@@ -25,7 +25,7 @@
 )
 
 func compile(t *testing.T, source string) (*semantic.API, error) {
-	parsed, errs := parser.Parse(source)
+	parsed, errs := parser.Parse("no_unreachables_test.api", source)
 	if err := commands.CheckErrors(source, errs); err != nil {
 		return nil, err
 	}
diff --git a/api/parser/parser.go b/api/parser/parser.go
index f769a22..f45b9dc 100644
--- a/api/parser/parser.go
+++ b/api/parser/parser.go
@@ -26,11 +26,11 @@
 // If the string is not syntactically valid, it will also return the
 // errors encountered. If errors are returned, the ast returned will be
 // the incomplete tree so far, and may not be structurally valid.
-func Parse(data string) (*ast.API, parse.ErrorList) {
+func Parse(filename, data string) (*ast.API, parse.ErrorList) {
 	var api *ast.API
 	parser := func(p *parse.Parser, cst *parse.Branch) {
 		api = requireAPI(p, cst)
 	}
-	errors := parse.Parse(parser, data, parse.NewSkip("//", "/*", "*/"))
+	errors := parse.Parse(parser, filename, data, parse.NewSkip("//", "/*", "*/"))
 	return api, errors
 }
diff --git a/api/parser/parser_test.go b/api/parser/parser_test.go
index b7dfa5a..ac5ba2b 100644
--- a/api/parser/parser_test.go
+++ b/api/parser/parser_test.go
@@ -76,14 +76,17 @@
 }
 
 func TestParsedCST(t *testing.T) {
-	runes := make([]rune, 0, 0xffff) // needs to be big enough to not be resized
+	source := &parse.Source{
+		Filename: "parser_test.api",
+		Runes:    make([]rune, 0, 0xffff), // needs to be big enough to not be resized
+	}
 	B := func(n ...parse.Node) *parse.Branch { return &parse.Branch{Children: n} }
 	L := func(str string) *parse.Leaf {
 		r := []rune(str)
-		s, e := len(runes), len(runes)+len(r)
-		runes = append(append(runes, r...), '·')
+		s, e := len(source.Runes), len(source.Runes)+len(r)
+		source.Runes = append(append(source.Runes, r...), '·')
 		l := &parse.Leaf{}
-		l.SetToken(parse.Token{Runes: runes, Start: s, End: e})
+		l.SetToken(parse.Token{Source: source, Start: s, End: e})
 		return l
 	}
 
@@ -104,7 +107,7 @@
 			expected: B(B(B(B(L("const"), B(B(L("char")), L("*"))), L("const"), L("*")), L("a"))),
 		},
 	} {
-		api, errs := Parse(test.source)
+		api, errs := Parse("parser_test.api", test.source)
 		m := map[parse.Node][]ast.Node{api.Node(): {api}}
 		var traverse func(n ast.Node)
 		traverse = func(n ast.Node) {
diff --git a/api/resolver/resolve_test.go b/api/resolver/resolve_test.go
index 3d8c1ce..e0037cd 100644
--- a/api/resolver/resolve_test.go
+++ b/api/resolver/resolve_test.go
@@ -59,7 +59,7 @@
 			errors: []string{"2:37: array index 3 is out of bounds for u32[3]"},
 		},
 	} {
-		astAPI, errs := parser.Parse(test.source)
+		astAPI, errs := parser.Parse("resolve_test.api", test.source)
 		if len(errs) > 0 {
 			t.Errorf("Testing '%s' - Unexpected parse errors: %v", test.name, errs)
 			continue
diff --git a/atom/schema.go b/atom/schema.go
index d526099..2390100 100644
--- a/atom/schema.go
+++ b/atom/schema.go
@@ -23,7 +23,7 @@
 // Metadata is the meta information about an atom type that is added to the
 // binary schema class for the atom.
 type Metadata struct {
-	binary.Generate
+	binary.Generate  `java:"AtomMetadata"`
 	API              gfxapi.ID // The api this atom belongs to.
 	DisplayName      string    // The display name for this atom type.
 	EndOfFrame       bool      // Indicates the atom is an end of frame marker.
diff --git a/binary/schema/class.go b/binary/schema/class.go
index 99ebdb4..971693a 100644
--- a/binary/schema/class.go
+++ b/binary/schema/class.go
@@ -22,13 +22,13 @@
 
 // Class represents an encodable object type with a type ID.
 type Class struct {
-	binary.Generate
-	TypeID   binary.ID       // The unique type identifier for the Object.
-	Package  string          // The package that declared the struct.
-	Name     string          // The simple name of the Object.
-	Exported bool            // Whether the class is exported from it's package
-	Fields   FieldList       // Descriptions of the fields of the Object.
-	Metadata []binary.Object // The metadata for the class.
+	binary.Generate `java:"SchemaClass"`
+	TypeID          binary.ID       // The unique type identifier for the Object.
+	Package         string          // The package that declared the struct.
+	Name            string          // The simple name of the Object.
+	Exported        bool            // Whether the class is exported from it's package
+	Fields          FieldList       // Descriptions of the fields of the Object.
+	Metadata        []binary.Object // The metadata for the class.
 }
 
 // Field represents a name/type pair for a field in an Object.
diff --git a/gfxapi/gles/glsl/preprocessor/constants.go b/gfxapi/gles/glsl/preprocessor/constants.go
index 0406518..d0a0778 100644
--- a/gfxapi/gles/glsl/preprocessor/constants.go
+++ b/gfxapi/gles/glsl/preprocessor/constants.go
@@ -37,12 +37,6 @@
 	Cst        *parse.Leaf // Structure containing the preceeding and following whitespace.
 }
 
-func (ti *TokenInfo) setToken(t Token) {
-	ti.Token = t
-	str := []rune(t.String())
-	ti.Cst.SetToken(parse.Token{str, 0, len(str)})
-}
-
 // Keyword represents a language keyword token returned by the preprocessor.
 type Keyword struct {
 	word *string
diff --git a/gfxapi/gles/glsl/preprocessor/lexer.go b/gfxapi/gles/glsl/preprocessor/lexer.go
index 4ebafcc..05b04a5 100644
--- a/gfxapi/gles/glsl/preprocessor/lexer.go
+++ b/gfxapi/gles/glsl/preprocessor/lexer.go
@@ -220,11 +220,11 @@
 
 /////////////////////////// Lexer interface below /////////////////////////////
 
-func newLexer(input string) *lexer {
+func newLexer(filename, input string) *lexer {
 	input = processLineContinuations(input)
 	l := &lexer{
 		current: TokenInfo{Newline: true, Cst: &parse.Leaf{}},
-		reader:  parse.NewReader(input),
+		reader:  parse.NewReader(filename, input),
 	}
 	l.current.Cst.AddPrefix(l.skip(parse.SkipPrefix))
 	l.read()
diff --git a/gfxapi/gles/glsl/preprocessor/preprocessorImpl.go b/gfxapi/gles/glsl/preprocessor/preprocessorImpl.go
index 1ea1954..b13d058 100644
--- a/gfxapi/gles/glsl/preprocessor/preprocessorImpl.go
+++ b/gfxapi/gles/glsl/preprocessor/preprocessorImpl.go
@@ -18,6 +18,7 @@
 	"android.googlesource.com/platform/tools/gpu/gfxapi/gles/glsl/ast"
 	"android.googlesource.com/platform/tools/gpu/parse"
 	"bytes"
+	"fmt"
 )
 
 // ifEntry is a structure containing the data necessary for proper evaluation of #if*
@@ -356,7 +357,7 @@
 	// append fake EOF
 	lastToken := args[len(args)-1].Cst.Token()
 	eof := &parse.Leaf{}
-	eof.SetToken(parse.Token{Runes: lastToken.Runes, Start: lastToken.End, End: lastToken.End})
+	eof.SetToken(parse.Token{Source: lastToken.Source, Start: lastToken.End, End: lastToken.End})
 	args = append(args, TokenInfo{Token: nil, Cst: eof})
 
 	var list []tokenExpansion
@@ -508,7 +509,7 @@
 
 func newPreprocessorImpl(data string, eval ExpressionEvaluator, file int) *preprocessorImpl {
 	p := &preprocessorImpl{
-		lexer:     newLexer(data),
+		lexer:     newLexer(fmt.Sprintf("File %v", file), data),
 		macros:    make(map[string]macroDefinition),
 		evaluator: eval,
 	}
diff --git a/parse/cst_test.go b/parse/cst_test.go
index 7d233f5..ab9a094 100644
--- a/parse/cst_test.go
+++ b/parse/cst_test.go
@@ -126,8 +126,8 @@
 }
 
 func newStringToken(value string) Token {
-	runes := bytes.Runes([]byte(value))
-	return Token{Runes: runes, Start: 0, End: len(runes)}
+	source := &Source{Filename: "cst_test.api", Runes: bytes.Runes([]byte(value))}
+	return Token{Source: source, Start: 0, End: len(source.Runes)}
 }
 
 func nodeOf(v interface{}) Node {
diff --git a/parse/parser.go b/parse/parser.go
index 2692a98..972301a 100644
--- a/parse/parser.go
+++ b/parse/parser.go
@@ -37,11 +37,11 @@
 // Given a root parse function, the input string and the Skip controller, it builds a
 // and initializes a Parser, runs the root using it, verifies it worked
 // correctly and then returns the errors generated if any.
-func Parse(root BranchParser, data string, skip Skip) []Error {
+func Parse(root BranchParser, filename, data string, skip Skip) []Error {
 	p := &Parser{
 		skip: skip,
 	}
-	p.setData(data)
+	p.setData(filename, data)
 	p.parse(root)
 	return p.Errors
 }
diff --git a/parse/parser_test.go b/parse/parser_test.go
index a39fc5a..c2dc46b 100644
--- a/parse/parser_test.go
+++ b/parse/parser_test.go
@@ -121,7 +121,7 @@
 				t.Fatalf("Parsing not terminated after %v errors", i)
 			}
 		}
-	}, "", NewSkip("//", "/*", "*/"))
+	}, "parser_test.api", "", NewSkip("//", "/*", "*/"))
 	if len(errs) != ParseErrorLimit {
 		t.Fatalf("Expected %v errors, got %v", ParseErrorLimit, len(errs))
 	}
@@ -138,7 +138,7 @@
 		content += " "
 	}
 	content += "@  \n  "
-	errs := Parse(root.parse, content, NewSkip("//", "/*", "*/"))
+	errs := Parse(root.parse, "parser_test.api", content, NewSkip("//", "/*", "*/"))
 	if len(errs) == 0 {
 		t.Fatalf("Expected errors")
 	}
@@ -161,7 +161,7 @@
 			t.Fatalf("Expected custom panic recovery")
 		}
 	}()
-	Parse(func(p *Parser, _ *Branch) { panic(custom) }, "", NewSkip("//", "/*", "*/"))
+	Parse(func(p *Parser, _ *Branch) { panic(custom) }, "parser_test.api", "", NewSkip("//", "/*", "*/"))
 }
 
 func testParse(t *testing.T, content string, cst Node, ast *listNode) {
@@ -171,7 +171,7 @@
 		gotCst = cst
 		root.parse(p, cst)
 	}
-	errs := Parse(rootParse, content, NewSkip("//", "/*", "*/"))
+	errs := Parse(rootParse, "parser_test.api", content, NewSkip("//", "/*", "*/"))
 	if len(errs) > 0 {
 		for _, e := range errs {
 			line, column := e.At.Token().Cursor()
@@ -198,7 +198,7 @@
 }
 
 func testCustomFail(t *testing.T, content string, do BranchParser) {
-	errs := Parse(do, content, NewSkip("//", "/*", "*/"))
+	errs := Parse(do, "parser_test.api", content, NewSkip("//", "/*", "*/"))
 	if len(errs) == 0 {
 		t.Fatalf("Expected errors")
 	} else {
diff --git a/parse/reader.go b/parse/reader.go
index 241f152..564ee34 100644
--- a/parse/reader.go
+++ b/parse/reader.go
@@ -22,18 +22,20 @@
 
 // Reader is the interface to an object that converts a rune array into tokens.
 type Reader struct {
-	runes  []rune // The string being parsed.
-	offset int    // The start of the current token.
-	cursor int    // The offset of the next unparsed rune.
+	Source *Source // The source being parsed.
+	runes  []rune  // The string being parsed.
+	offset int     // The start of the current token.
+	cursor int     // The offset of the next unparsed rune.
 }
 
-func (r *Reader) setData(data string) {
+func (r *Reader) setData(filename string, data string) {
 	r.runes = bytes.Runes([]byte(data))
+	r.Source = &Source{Filename: filename, Runes: r.runes}
 }
 
 // Token peeks at the current scanned token value. It does not consume anything.
 func (r *Reader) Token() Token {
-	return Token{Runes: r.runes, Start: r.offset, End: r.cursor}
+	return Token{Source: r.Source, Start: r.offset, End: r.cursor}
 }
 
 // Consume consumes the current token.
@@ -315,8 +317,8 @@
 }
 
 // NewReader creates a new reader which reads from the supplied string.
-func NewReader(data string) *Reader {
+func NewReader(filename string, data string) *Reader {
 	r := &Reader{}
-	r.setData(data)
+	r.setData(filename, data)
 	return r
 }
diff --git a/parse/reader_test.go b/parse/reader_test.go
index bf40546..db39a51 100644
--- a/parse/reader_test.go
+++ b/parse/reader_test.go
@@ -43,7 +43,7 @@
 
 func TestNumeric(t *testing.T) {
 	for _, test := range numericTests {
-		r := NewReader(test.in)
+		r := NewReader("reader_test.api", test.in)
 		gotKind := r.Numeric()
 		gotTok := r.Token()
 
diff --git a/parse/source.go b/parse/source.go
new file mode 100644
index 0000000..c2ca291
--- /dev/null
+++ b/parse/source.go
@@ -0,0 +1,20 @@
+// Copyright (C) 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package parse
+
+type Source struct {
+	Filename string // The path which was used to load the source (if any).
+	Runes    []rune // The full content of the source file.
+}
diff --git a/parse/token.go b/parse/token.go
index d93ad7f..8150314 100644
--- a/parse/token.go
+++ b/parse/token.go
@@ -23,9 +23,9 @@
 
 // A Token represents the smallest consumed unit input.
 type Token struct {
-	Runes []rune // The full rune array for the string this token is from.
-	Start int    // The start of the token in the full rune array.
-	End   int    // One past the end of the token.
+	Source *Source // The source object this token is from (including the full rune array).
+	Start  int     // The start of the token in the full rune array.
+	End    int     // One past the end of the token.
 }
 
 // Format implements fmt.Formatter writing the start end and value of the token.
@@ -35,10 +35,10 @@
 
 // String returns the string form of the rune range the token represents.
 func (t Token) String() string {
-	if t.Start >= t.End || len(t.Runes) == 0 {
+	if t.Start >= t.End || len(t.Source.Runes) == 0 {
 		return ""
 	}
-	return string(t.Runes[t.Start:t.End])
+	return string(t.Source.Runes[t.Start:t.End])
 }
 
 // Cursor is used to calculate the line and column of the start of the token.
@@ -47,7 +47,7 @@
 func (t Token) Cursor() (line int, column int) {
 	line = 1
 	column = 1
-	for _, r := range t.Runes[:t.Start] {
+	for _, r := range t.Source.Runes[:t.Start] {
 		if r == RuneEOL {
 			line++
 			column = 0
diff --git a/tools/codergen/template/embed.go b/tools/codergen/template/embed.go
index 80ca462..893e1ea 100644
--- a/tools/codergen/template/embed.go
+++ b/tools/codergen/template/embed.go
@@ -1028,10 +1028,10 @@
   @Override @NotNull¶
   public BinaryClass klass() { return Klass.INSTANCE; }¶

-  public static byte[] IDBytes = {
+  private static final byte[] IDBytes = {
     {{range .Struct.ID}}{{ToS8 .}}, {{end}}
   •};¶
-  public static BinaryID ID = new BinaryID(IDBytes);¶
+  public static final BinaryID ID = new BinaryID(IDBytes);¶

   static {Ȧ
     Namespace.register(ID, Klass.INSTANCE);¶
@@ -1156,7 +1156,7 @@
 {{end}}
 
 {{define "Java.ClientRPC"}}
-  §{{$.Copyright}}§
+  §{{$.Copyright}}§¶
   package {{.JavaPackage}};¶

   {{template "Java.Imports" .}}
@@ -1167,7 +1167,7 @@
   {{Call "Java.Import" "com.google.common.util.concurrent.ListeningExecutorService"}}
   {{Call "Java.Import" "com.google.common.util.concurrent.ListenableFuture"}}

-  public class {{.Service.Name}}ClientRPC extends {{.Service.Name}}Client {Ȧ
+  public final class {{.Service.Name}}ClientRPC extends {{.Service.Name}}Client {Ȧ
     private final Broadcaster myBroadcaster;¶
     private final ListeningExecutorService myExecutorService;¶

@@ -1207,7 +1207,7 @@
 {{end}}
 
 {{define "Java.ClientWrapper"}}
-  §{{$.Copyright}}§
+  §{{$.Copyright}}§¶
   package {{.JavaPackage}};¶

   {{template "Java.Imports" .}}
diff --git a/tools/codergen/template/java_binary.tmpl b/tools/codergen/template/java_binary.tmpl
index b3f3e68..9894982 100644
--- a/tools/codergen/template/java_binary.tmpl
+++ b/tools/codergen/template/java_binary.tmpl
@@ -122,10 +122,10 @@
   @Override @NotNull¶
   public BinaryClass klass() { return Klass.INSTANCE; }¶

-  public static byte[] IDBytes = {
+  private static final byte[] IDBytes = {
     {{range .Struct.ID}}{{ToS8 .}}, {{end}}
   •};¶
-  public static BinaryID ID = new BinaryID(IDBytes);¶
+  public static final BinaryID ID = new BinaryID(IDBytes);¶

   static {Ȧ
     Namespace.register(ID, Klass.INSTANCE);¶
diff --git a/tools/codergen/template/java_client.tmpl b/tools/codergen/template/java_client.tmpl
index fa09fa9..34777f8 100644
--- a/tools/codergen/template/java_client.tmpl
+++ b/tools/codergen/template/java_client.tmpl
@@ -54,7 +54,7 @@
 {{end}}
 
 {{define "Java.ClientRPC"}}
-  §{{$.Copyright}}§
+  §{{$.Copyright}}§¶
   package {{.JavaPackage}};¶

   {{template "Java.Imports" .}}
@@ -65,7 +65,7 @@
   {{Call "Java.Import" "com.google.common.util.concurrent.ListeningExecutorService"}}
   {{Call "Java.Import" "com.google.common.util.concurrent.ListenableFuture"}}

-  public class {{.Service.Name}}ClientRPC extends {{.Service.Name}}Client {Ȧ
+  public final class {{.Service.Name}}ClientRPC extends {{.Service.Name}}Client {Ȧ
     private final Broadcaster myBroadcaster;¶
     private final ListeningExecutorService myExecutorService;¶

@@ -105,7 +105,7 @@
 {{end}}
 
 {{define "Java.ClientWrapper"}}
-  §{{$.Copyright}}§
+  §{{$.Copyright}}§¶
   package {{.JavaPackage}};¶

   {{template "Java.Imports" .}}
diff --git a/tools/copyright/embed.go b/tools/copyright/embed.go
index 21f7ddc..d011e1e 100644
--- a/tools/copyright/embed.go
+++ b/tools/copyright/embed.go
@@ -23,6 +23,7 @@
 	generated_aosp_java_file: generated_aosp_java,
 	generated_bad_java_file:  generated_bad_java,
 	generated_by_file:        generated_by,
+	generated_old_java_file:  generated_old_java,
 	generated_protoc_file:    generated_protoc,
 	generated_stringer_file:  generated_stringer,
 }
@@ -253,9 +254,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
- * THIS WILL BE REMOVED ONCE THE CODE GENERATOR IS INTEGRATED INTO THE BUILD.
+ * THIS FILE WAS GENERATED BY «Tool». EDIT WITH CARE.
  */
-
 `
 const generated_bad_java_file = `generated_bad_java`
 const generated_bad_java = `/*
@@ -283,6 +283,26 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 `
+const generated_old_java_file = `generated_old_java`
+const generated_old_java = `/*
+ * Copyright (C) «Year» The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * THIS WILL BE REMOVED ONCE THE CODE GENERATOR IS INTEGRATED INTO THE BUILD.
+ */
+
+`
 const generated_protoc_file = `generated_protoc`
 const generated_protoc = `// Generated by the protocol buffer compiler.  DO NOT EDIT!
 `
diff --git a/tools/copyright/generated_aosp_java b/tools/copyright/generated_aosp_java
index 9818a36..7f3c111 100644
--- a/tools/copyright/generated_aosp_java
+++ b/tools/copyright/generated_aosp_java
@@ -13,6 +13,5 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
- * THIS WILL BE REMOVED ONCE THE CODE GENERATOR IS INTEGRATED INTO THE BUILD.
+ * THIS FILE WAS GENERATED BY «Tool». EDIT WITH CARE.
  */
-
diff --git a/tools/copyright/generated_old_java b/tools/copyright/generated_old_java
new file mode 100644
index 0000000..9818a36
--- /dev/null
+++ b/tools/copyright/generated_old_java
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) «Year» The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * THIS WILL BE REMOVED ONCE THE CODE GENERATOR IS INTEGRATED INTO THE BUILD.
+ */
+
diff --git a/tools/generate_gles_api/generate_api.go b/tools/generate_gles_api/generate_api.go
index ee143b8..f443c6c 100644
--- a/tools/generate_gles_api/generate_api.go
+++ b/tools/generate_gles_api/generate_api.go
@@ -375,7 +375,7 @@
 				if len(childs) > 0 {
 					start := apiCmd.Block.CST.Children[0].Token()
 					end := apiCmd.Block.CST.Children[len(childs)-1].Token()
-					fmt.Fprintf(out, "%s", string(start.Runes[start.End:end.Start]))
+					fmt.Fprintf(out, "%s", string(start.Source.Runes[start.End:end.Start]))
 					foundOldCode = true
 				}
 			}
@@ -408,7 +408,7 @@
 		for _, cmd := range oldApi.Commands {
 			if cmd.Name.Value == cmdName {
 				token := cmd.Parameters[paramIndex].Type.Node().Token()
-				return string(token.Runes[token.Start:token.End]), true
+				return string(token.Source.Runes[token.Start:token.End]), true
 			}
 		}
 	}
diff --git a/tools/generate_gles_api/main.go b/tools/generate_gles_api/main.go
index 4771814..bf48deb 100644
--- a/tools/generate_gles_api/main.go
+++ b/tools/generate_gles_api/main.go
@@ -41,7 +41,7 @@
 		if err != nil {
 			panic(err)
 		}
-		api, errs := parser.Parse(string(f))
+		api, errs := parser.Parse(*oldApiPath, string(f))
 		if len(errs) > 0 {
 			for i, e := range errs {
 				fmt.Printf("%d: %v", i, e)