Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 69 for parseRule (0.31 sec)

  1. src/internal/types/errors/generrordocs.go

    		}
    	})
    	log.Printf("output directory: %s\n", outDir)
    }
    
    func walkCodes(f func(string, *ast.ValueSpec)) {
    	fset := token.NewFileSet()
    	file, err := parser.ParseFile(fset, "codes.go", nil, parser.ParseComments)
    	if err != nil {
    		log.Fatalf("ParseFile failed: %s", err)
    	}
    	conf := Config{Importer: importer.Default()}
    	info := &Info{
    		Types: make(map[ast.Expr]TypeAndValue),
    		Defs:  make(map[*ast.Ident]Object),
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 24 03:14:42 UTC 2023
    - 3K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/syntax/syntax.go

    				return
    			}
    			panic(p)
    		}
    	}()
    
    	var p parser
    	p.init(base, src, errh, pragh, mode)
    	p.next()
    	return p.fileOrNil(), p.first
    }
    
    // ParseFile behaves like Parse but it reads the source from the named file.
    func ParseFile(filename string, errh ErrorHandler, pragh PragmaHandler, mode Mode) (*File, error) {
    	f, err := os.Open(filename)
    	if err != nil {
    		if errh != nil {
    			errh(err)
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 01 18:18:07 UTC 2022
    - 3.1K bytes
    - Viewed (0)
  3. tools/docker-builder/dockerfile/parse.go

    	Flags     []string // Any flags such as `--from=...` for `COPY`.
    	Value     []string // The contents of the command (ex: `ubuntu:xenial`)
    }
    
    // parseFile parses a Dockerfile from a filename.
    func parseFile(filename string) ([]Command, error) {
    	file, err := os.Open(filename)
    	if err != nil {
    		return nil, err
    	}
    	defer file.Close()
    
    	res, err := parser.Parse(file)
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 17:08:31 UTC 2023
    - 5.8K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/syntax/dumper_test.go

    // license that can be found in the LICENSE file.
    
    package syntax
    
    import (
    	"testing"
    )
    
    func TestDump(t *testing.T) {
    	if testing.Short() {
    		t.Skip("skipping test in short mode")
    	}
    
    	ast, _ := ParseFile(*src_, func(err error) { t.Error(err) }, nil, CheckBranches)
    
    	if ast != nil {
    		Fdump(testOut(), ast)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 30 18:02:31 UTC 2022
    - 424 bytes
    - Viewed (0)
  5. src/go/ast/walk_test.go

    	// bug, this test failed with a runtime panic.
    	src := "package p\ntype T struct {\n\tF int `json:\"f\"` // a field\n}\n"
    
    	fset := token.NewFileSet()
    	f, err := parser.ParseFile(fset, "", src, 0)
    	if err != nil {
    		panic(err)
    	}
    
    	for n := range ast.Preorder(f) {
    		if id, ok := n.(*ast.Ident); ok && id.Name == "F" {
    			break
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 16:34:10 UTC 2024
    - 916 bytes
    - Viewed (0)
  6. src/go/ast/commentmap_test.go

    	var buf strings.Builder
    	for _, g := range list {
    		buf.WriteString(g.Text())
    	}
    	return buf.String()
    }
    
    func TestCommentMap(t *testing.T) {
    	fset := token.NewFileSet()
    	f, err := parser.ParseFile(fset, "", src, parser.ParseComments)
    	if err != nil {
    		t.Fatal(err)
    	}
    	cmap := NewCommentMap(fset, f, f.Comments)
    
    	// very correct association of comments
    	for n, list := range cmap {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 09 15:35:30 UTC 2022
    - 3.9K bytes
    - Viewed (0)
  7. src/go/ast/issues_test.go

    	for _, src := range []string{
    		`package p; func _()`,
    		`package p; func _() {`,
    		`package p; func _() { _ = 0`,
    		`package p; func _() { _ = 0 }`,
    	} {
    		fset := token.NewFileSet()
    		f, _ := parser.ParseFile(fset, "", src, parser.AllErrors)
    		if f == nil {
    			panic("invalid test setup: parser didn't return an AST")
    		}
    
    		// find corresponding token.File
    		var tf *token.File
    		fset.Iterate(func(f *token.File) bool {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 25 13:57:33 UTC 2023
    - 3.5K bytes
    - Viewed (0)
  8. src/internal/dag/parse.go

    	less []string
    	op   string // Either "<" or "!<"
    	def  []string
    }
    
    type syntaxError string
    
    func (e syntaxError) Error() string {
    	return string(e)
    }
    
    // parseRules parses the rules of a DAG.
    func parseRules(rules string) (out []rule, err error) {
    	defer func() {
    		e := recover()
    		switch e := e.(type) {
    		case nil:
    			return
    		case syntaxError:
    			err = e
    		default:
    			panic(e)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 6.7K bytes
    - Viewed (0)
  9. src/go/printer/performance_test.go

    func initialize() {
    	const filename = "testdata/parser.go"
    
    	src, err := os.ReadFile(filename)
    	if err != nil {
    		log.Fatalf("%s", err)
    	}
    
    	file, err := parser.ParseFile(fset, filename, src, parser.ParseComments)
    	if err != nil {
    		log.Fatalf("%s", err)
    	}
    
    	var buf bytes.Buffer
    	testprint(&buf, file)
    	if !bytes.Equal(buf.Bytes(), src) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 09 15:10:10 UTC 2022
    - 1.8K bytes
    - Viewed (0)
  10. src/internal/types/errors/codes_test.go

    				}
    			}
    		})
    	})
    }
    
    func walkCodes(t *testing.T, f func(string, int, *ast.ValueSpec)) {
    	t.Helper()
    	fset := token.NewFileSet()
    	file, err := parser.ParseFile(fset, "codes.go", nil, parser.ParseComments)
    	if err != nil {
    		t.Fatal(err)
    	}
    	conf := Config{Importer: importer.Default()}
    	info := &Info{
    		Types: make(map[ast.Expr]TypeAndValue),
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 18 20:41:45 UTC 2022
    - 4.9K bytes
    - Viewed (0)
Back to top