diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2022-05-09 20:49:16 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2022-05-10 23:14:52 +0900 |
commit | 0b858d664433d0b11e1d46dbd774e19da5b5a750 (patch) | |
tree | 3fe7dff648e8fc699dccbfec181e287220603409 | |
parent | Change the suffix of a description file from -description.json to -report.json (diff) | |
download | urubu-0b858d664433d0b11e1d46dbd774e19da5b5a750.tar.gz urubu-0b858d664433d0b11e1d46dbd774e19da5b5a750.tar.xz |
Change the default suffix of a grammar file from .vr to .vartan
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | cmd/vartan/compile.go | 6 |
2 files changed, 5 insertions, 5 deletions
@@ -67,7 +67,7 @@ div : '/'; ``` -Save the above grammar to a file in UTF-8. In this explanation, the file name is `expr.vr`. +Save the above grammar to a file in UTF-8. In this explanation, the file name is `expr.vartan`. ⚠️ The input file must be encoded in UTF-8. @@ -76,7 +76,7 @@ Save the above grammar to a file in UTF-8. In this explanation, the file name is Next, generate a parsing table using `vartan compile` command. ```sh -$ vartan compile expr.vr -o expr.json +$ vartan compile expr.vartan -o expr.json ``` ### 3. Debug diff --git a/cmd/vartan/compile.go b/cmd/vartan/compile.go index 16eef16..70d01b2 100644 --- a/cmd/vartan/compile.go +++ b/cmd/vartan/compile.go @@ -24,7 +24,7 @@ func init() { cmd := &cobra.Command{ Use: "compile", Short: "Compile grammar you defined into a parsing table", - Example: ` vartan compile grammar.vr -o grammar.json`, + Example: ` vartan compile grammar.vartan -o grammar.json`, Args: cobra.MaximumNArgs(1), RunE: runCompile, } @@ -95,7 +95,7 @@ func runCompile(cmd *cobra.Command, args []string) (retErr error) { return err } - grmPath = filepath.Join(tmpDirPath, "stdin.vr") + grmPath = filepath.Join(tmpDirPath, "stdin.vartan") err = ioutil.WriteFile(grmPath, src, 0600) if err != nil { return err @@ -110,7 +110,7 @@ func runCompile(cmd *cobra.Command, args []string) (retErr error) { var reportFileName string { _, grmFileName := filepath.Split(grmPath) - reportFileName = fmt.Sprintf("%v-report.json", strings.TrimSuffix(grmFileName, ".vr")) + reportFileName = fmt.Sprintf("%v-report.json", strings.TrimSuffix(grmFileName, ".vartan")) } opts := []grammar.CompileOption{ |