mirror of
https://github.com/hazemKrimi/jack-compiler.git
synced 2026-05-02 01:50:25 +00:00
chore: rename parser back to compilation engine
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package parser
|
package engine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
@@ -637,7 +637,7 @@ func compileClass(output *strings.Builder, tokens []tokenizer.Token) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseTokens(tokens []tokenizer.Token) (string, error) {
|
func Compile(tokens []tokenizer.Token) (string, error) {
|
||||||
var output strings.Builder
|
var output strings.Builder
|
||||||
|
|
||||||
if err := compileClass(&output, tokens); err != nil {
|
if err := compileClass(&output, tokens); err != nil {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ func process(inputPath string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
parsed, err := parser.ParseTokens(tokens)
|
compiled, err := engine.Compile(tokens)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -34,7 +34,7 @@ func process(inputPath string) error {
|
|||||||
|
|
||||||
outputPath := strings.Replace(inputPath, ".jack", ".xml", 1)
|
outputPath := strings.Replace(inputPath, ".jack", ".xml", 1)
|
||||||
|
|
||||||
if err := os.WriteFile(outputPath, []byte(parsed), 0644); err != nil {
|
if err := os.WriteFile(outputPath, []byte(compiled), 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user