-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
75 changed files
with
1,492 additions
and
13,454 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package main | ||
|
||
//go:generate antlr4 -visitor -no-visitor -listener -o internal/parser -Dlanguage=Go LDE.g4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,13 @@ | ||
module github.com/sirkon/ldetool/v3 | ||
module github.com/sirkon/ldetool | ||
|
||
require ( | ||
github.com/antlr/antlr4 v0.0.0-20190207013812-1c6c62afc7cb | ||
github.com/antlr/antlr4 v0.0.0-20190313170020-28fc84874d7f | ||
github.com/go-yaml/yaml v2.1.0+incompatible | ||
github.com/kr/pretty v0.1.0 // indirect | ||
github.com/sanity-io/litter v1.1.0 | ||
github.com/sirkon/decconv v1.0.0 | ||
github.com/sirkon/gosrcfmt v1.5.0 | ||
github.com/sirkon/gotify v0.5.0 | ||
github.com/sirkon/ldetool/internal v0.0.0-00010101000000-000000000000 | ||
github.com/sirkon/gotify v0.6.0 | ||
github.com/sirkon/message v1.5.1 | ||
github.com/stretchr/testify v1.2.2 | ||
github.com/stretchr/testify v1.3.0 | ||
github.com/urfave/cli v1.20.0 | ||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect | ||
gopkg.in/yaml.v2 v2.2.1 // indirect | ||
) | ||
|
||
replace github.com/sirkon/ldetool/internal => ./internal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package ast | ||
|
||
var _ Action = &PassAfterOrIgnore{} | ||
|
||
// PassAfterOrIgnore ... | ||
type PassAfterOrIgnore struct { | ||
access | ||
Limit *Target | ||
} | ||
|
||
func (p *PassAfterOrIgnore) Accept(d ActionDispatcher) error { | ||
return d.DispatchPassAfterOrIgnore(p) | ||
} | ||
|
||
func (p *PassAfterOrIgnore) String() string { | ||
pu := &PassAfter{ | ||
Limit: p.Limit, | ||
} | ||
if p.Limit.Lower == p.Limit.Upper && p.Limit.Lower > 0 { | ||
return pu.String() + " or ignore otherwise" | ||
} else { | ||
return pu.String() + " or ignore if not found" | ||
} | ||
} | ||
|
||
// PassAfterTargetOrIgnore ... | ||
func PassAfterTargetOrIgnore() *PassAfterOrIgnore { | ||
return &PassAfterOrIgnore{ | ||
Limit: NewTarget(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package ast | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
var _ Action = &PassBefore{} | ||
|
||
// PassBefore ... | ||
type PassBefore struct { | ||
access | ||
Limit *Target | ||
} | ||
|
||
func (pu *PassBefore) Accept(d ActionDispatcher) error { | ||
return d.DispatchPassBefore(pu) | ||
} | ||
|
||
func (pu *PassBefore) String() string { | ||
if pu.Limit.Lower == pu.Limit.Upper && pu.Limit.Lower > 0 { | ||
switch pu.Limit.Type { | ||
case String: | ||
return fmt.Sprintf("Check if the rest at %s character and further starts with prefix %s and pass until it", posLit(pu.Limit.Lower+1), pu.Limit.Value) | ||
case Char: | ||
return fmt.Sprintf("Check if %s character equals to %s and pass until it", posLit(pu.Limit.Lower+1), pu.Limit.Value) | ||
} | ||
} | ||
|
||
var area string | ||
if pu.Limit.Lower > 0 && pu.Limit.Upper > 0 { | ||
area = fmt.Sprintf("rest[%d:%d]", pu.Limit.Lower, pu.Limit.Upper) | ||
} else if pu.Limit.Lower > 0 { | ||
area = fmt.Sprintf("rest[%d:]", pu.Limit.Lower) | ||
} else { | ||
area = "the rest" | ||
} | ||
res := fmt.Sprintf("Look for \033[1m%s\033[0m in %s without passing it", pu.Limit.Value, area) | ||
return res | ||
} | ||
|
||
// PassBeforeTarget ... | ||
func PassBeforeTarget() *PassBefore { | ||
return &PassBefore{ | ||
Limit: NewTarget(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package ast | ||
|
||
var _ Action = &PassBeforeOrIgnore{} | ||
|
||
// PassBeforeOrIgnore ... | ||
type PassBeforeOrIgnore struct { | ||
access | ||
Limit *Target | ||
} | ||
|
||
func (p *PassBeforeOrIgnore) Accept(d ActionDispatcher) error { | ||
return d.DispatchPassBeforeOrIgnore(p) | ||
} | ||
|
||
func (p *PassBeforeOrIgnore) String() string { | ||
pu := &PassBefore{ | ||
Limit: p.Limit, | ||
} | ||
if p.Limit.Lower == p.Limit.Upper && p.Limit.Lower > 0 { | ||
return pu.String() + " or ignore otherwise" | ||
} else { | ||
return pu.String() + " or ignore if not found" | ||
} | ||
} | ||
|
||
// PassBeforeTargetOrIgnore ... | ||
func PassBeforeTargetOrIgnore() *PassBeforeOrIgnore { | ||
return &PassBeforeOrIgnore{ | ||
Limit: NewTarget(), | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package ast | ||
|
||
import ( | ||
"fmt" | ||
"github.com/antlr/antlr4/runtime/Go/antlr" | ||
) | ||
|
||
var _ Action = &StartCharWithoutPass{} | ||
|
||
// StartCharWithoutPass ... | ||
type StartCharWithoutPass struct { | ||
access | ||
Value string | ||
} | ||
|
||
func (sc *StartCharWithoutPass) Accept(d ActionDispatcher) error { | ||
return d.DispatchStartCharWithoutPass(sc) | ||
} | ||
|
||
func (sc *StartCharWithoutPass) String() string { | ||
return fmt.Sprintf("Check and pass character \033[1m%s\033[0m", sc.Value) | ||
} | ||
|
||
// StartsWithCharWithoutPass ... | ||
func StartsWithCharWithoutPass(target antlr.Token) *StartCharWithoutPass { | ||
return &StartCharWithoutPass{Value: target.GetText()} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package ast | ||
|
||
import ( | ||
"fmt" | ||
"github.com/antlr/antlr4/runtime/Go/antlr" | ||
) | ||
|
||
var _ Action = &StartStringWithoutPass{} | ||
|
||
// StartStringWithoutPass ... | ||
type StartStringWithoutPass struct { | ||
access | ||
Value string | ||
} | ||
|
||
func (ss *StartStringWithoutPass) Accept(d ActionDispatcher) error { | ||
return d.DispatchStartStringWithoutPass(ss) | ||
} | ||
|
||
func (ss *StartStringWithoutPass) String() string { | ||
return fmt.Sprintf("Check and pass \033[1m%s\033[0m", ss.Value) | ||
|
||
} | ||
|
||
// StartsWithStringWithoutPass constructor | ||
func StartsWithStringWithoutPass(target antlr.Token) *StartStringWithoutPass { | ||
return &StartStringWithoutPass{Value: target.GetText()} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.