MCPcopy Create free account
hub / github.com/EBWi11/AgentSmith-HUB / Token

Method Token

src/rules_engine/engine_parser.go:30–43  ·  view source on GitHub ↗

Token wraps the xml.Decoder Token method to track line numbers

()

Source from the content-addressed store, hash-verified

28
29// Token wraps the xml.Decoder Token method to track line numbers
30func (d *XMLDecoder) Token() (xml.Token, error) {
31 token, err := d.Decoder.Token()
32 if err != nil {
33 return token, err
34 }
35
36 // Count newlines in character data to track line numbers
37 switch t := token.(type) {
38 case xml.CharData:
39 d.line += strings.Count(string(t), "\n")
40 }
41
42 return token, nil
43}
44
45func ParseRuleset(rawRuleset []byte) (*Ruleset, error) {
46 // Create a custom decoder that tracks line numbers

Callers 11

ParseRulesetFunction · 0.95
parseIteratorFunction · 0.80
parseIteratorChecklistFunction · 0.80
parseSequenceFunction · 0.80
parseSequenceEventFunction · 0.80
parseCheckNodeFunction · 0.80
parseThresholdFunction · 0.80
parseAppendFunction · 0.80
parseModifyFunction · 0.80
parsePluginFunction · 0.80
parseDelFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected