Skip to content

Commit

Permalink
fixing windows incompatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Levinson committed Feb 27, 2018
1 parent ec36ed4 commit ebc557f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
3 changes: 1 addition & 2 deletions compiler/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"strings"
"text/template"

"github.com/alecthomas/chroma/quick"
"github.com/gen0cide/gscript/engine"
"github.com/gen0cide/gscript/logging"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -303,7 +302,7 @@ func (c *Compiler) writeSource() {
newSource := c.LollerSkateDaStringz([]byte(c.Source))
newSourceB := fmt.Sprintf("%s\n\n%s\n", string(newSource), c.GenerateTangledHairs())
if c.OutputSource {
quick.Highlight(os.Stdout, newSourceB, "go", "terminal", "vim")
PrettyPrintSource(newSourceB)
return
}
err := ioutil.WriteFile(filepath.Join(c.BuildDir, "main.go"), []byte(newSourceB), 0644)
Expand Down
13 changes: 13 additions & 0 deletions compiler/printer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// +build !windows

package compiler

import (
"os"

"github.com/alecthomas/chroma/quick"
)

func PrettyPrintSource(source string) {
quick.Highlight(os.Stdout, source, "go", "terminal", "vim")
}
9 changes: 9 additions & 0 deletions compiler/printer_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// +build windows

package compiler

import "fmt"

func PrettyPrintSource(source string) {
fmt.Println(source)
}

0 comments on commit ebc557f

Please sign in to comment.