Skip to content

Commit 9a41ddd

Browse files
committed
feat: add variable check for camel case
1 parent 4073b86 commit 9a41ddd

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

main.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,36 @@ import (
44
"bufio"
55
"fmt"
66
"os"
7+
"regexp"
78
"strings"
89
)
910

1011
var arguments []string = os.Args
1112
var parserIsInsideVariableBlock bool = false
13+
var isErrorDetected bool = false
14+
15+
func isCamelCase(input string) bool {
16+
expression := regexp.MustCompile(`^[a-z]+([A-Z][a-z]*)*$`)
17+
return expression.MatchString(input)
18+
}
1219

1320
func handleLine(input string) {
1421
inputWithoutWhiteSpaces := strings.ReplaceAll(input, " ", "")
1522
if parserIsInsideVariableBlock {
16-
23+
if strings.Contains(inputWithoutWhiteSpaces, "LibVersion") ||
24+
strings.Contains(inputWithoutWhiteSpaces, "S7_SetPoint") {
25+
fmt.Printf("System Call detected ignoring for now.\n")
26+
return
27+
}
28+
if strings.Contains(inputWithoutWhiteSpaces, ":") {
29+
parts := strings.Split(inputWithoutWhiteSpaces, ":")
30+
if isCamelCase(parts[0]) {
31+
fmt.Printf("Success: Variable %s is camel case.\n", parts[0])
32+
} else {
33+
fmt.Printf("Error: Variable %s is not camel case.\n", parts[0])
34+
}
35+
return
36+
}
1737
}
1838

1939
if inputWithoutWhiteSpaces == "VAR_INPUT" ||

0 commit comments

Comments
 (0)