Skip to content

Commit f37ff95

Browse files
committed
internal/filetypes: generate FromFile
This adds the generated code and data file to emulate the `filetypes.FromFile` function without using the CUE evaluator. For now, we keep the old implementation around to check for consistency between old and new. We'll remove the old implementation from the filetypes package in a subsequent CL. For #3280. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I82d6f66854381bf9eb802646384a56a1fa6e4057 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1214209 Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent 6454acb commit f37ff95

File tree

10 files changed

+451
-79
lines changed

10 files changed

+451
-79
lines changed

internal/filetypes/filetypes.go

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"cuelang.org/go/cue/build"
2424
"cuelang.org/go/cue/errors"
2525
"cuelang.org/go/cue/token"
26+
"cuelang.org/go/internal/filetypes/internal"
2627
)
2728

2829
// Mode indicate the base mode of operation and indicates a different set of
@@ -50,26 +51,7 @@ func (m Mode) String() string {
5051
}
5152
}
5253

53-
// FileInfo defines the parsing plan for a file.
54-
type FileInfo struct {
55-
Filename string `json:"filename"`
56-
Encoding build.Encoding `json:"encoding,omitempty"`
57-
Interpretation build.Interpretation `json:"interpretation,omitempty"`
58-
Form build.Form `json:"form,omitempty"`
59-
60-
Definitions bool `json:"definitions"` // include/allow definition fields
61-
Data bool `json:"data"` // include/allow regular fields
62-
Optional bool `json:"optional"` // include/allow definition fields
63-
Constraints bool `json:"constraints"` // include/allow constraints
64-
References bool `json:"references"` // don't resolve/allow references
65-
Cycles bool `json:"cycles"` // cycles are permitted
66-
KeepDefaults bool `json:"keepDefaults"` // select/allow default values
67-
Incomplete bool `json:"incomplete"` // permit incomplete values
68-
Imports bool `json:"imports"` // don't expand/allow imports
69-
Stream bool `json:"stream"` // permit streaming
70-
Docs bool `json:"docs"` // show/allow docs
71-
Attributes bool `json:"attributes"` // include/allow attributes
72-
}
54+
type FileInfo = internal.FileInfo
7355

7456
// ParseArgs converts a sequence of command line arguments representing
7557
// files into a sequence of build file specifications.

internal/filetypes/fromfile.dat

11.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)