MCPcopy
hub / github.com/wavetermdev/waveterm / Parse

Method Parse

pkg/vdom/cssparser/cssparser.go:29–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27}
28
29func (p *Parser) Parse() (map[string]string, error) {
30 result := make(map[string]string)
31 lastProp := ""
32 for {
33 p.skipWhitespace()
34 if p.eof() {
35 break
36 }
37 propName, err := p.parseIdentifierColon(lastProp)
38 if err != nil {
39 return nil, err
40 }
41 lastProp = propName
42 p.skipWhitespace()
43 value, err := p.parseValue(propName)
44 if err != nil {
45 return nil, err
46 }
47 result[propName] = value
48 p.skipWhitespace()
49 if p.eof() {
50 break
51 }
52 if !p.expectChar(';') {
53 break
54 }
55 }
56 p.skipWhitespace()
57 if !p.eof() {
58 return nil, fmt.Errorf("bad style attribute, unexpected character %q at pos %d", string(p.Input[p.Pos]), p.Pos+1)
59 }
60 return result, nil
61}
62
63func (p *Parser) parseIdentifierColon(lastProp string) (string, error) {
64 start := p.Pos

Callers 15

GetFaviconFunction · 0.80
parseSimpleIdFunction · 0.80
connutil.goFile · 0.80
ValidateMethod · 0.80
makeCancellableCommandFunction · 0.80
styleAttrStrToStyleMapFunction · 0.80
TestParse1Function · 0.80
TestParserErrorsFunction · 0.80
RunMainMethod · 0.80
handleWaveFileFunction · 0.80
GenerateTabStateAndToolsFunction · 0.80
WaveAIPostMessageHandlerFunction · 0.80

Calls 5

skipWhitespaceMethod · 0.95
eofMethod · 0.95
parseIdentifierColonMethod · 0.95
parseValueMethod · 0.95
expectCharMethod · 0.95

Tested by 2

TestParse1Function · 0.64
TestParserErrorsFunction · 0.64