doc.go

 1// Copyright 2012 The Gorilla Authors. All rights reserved.
 2// Use of this source code is governed by a BSD-style
 3// license that can be found in the LICENSE file.
 4
 5/*
 6Package gorilla/css/scanner generates tokens for a CSS3 input.
 7
 8It follows the CSS3 specification located at:
 9
10	http://www.w3.org/TR/css3-syntax/
11
12To use it, create a new scanner for a given CSS string and call Next() until
13the token returned has type TokenEOF or TokenError:
14
15	s := scanner.New(myCSS)
16	for {
17		token := s.Next()
18		if token.Type == scanner.TokenEOF || token.Type == scanner.TokenError {
19			break
20		}
21		// Do something with the token...
22	}
23
24Following the CSS3 specification, an error can only occur when the scanner
25finds an unclosed quote or unclosed comment. In these cases the text becomes
26"untokenizable". Everything else is tokenizable and it is up to a parser
27to make sense of the token stream (or ignore nonsensical token sequences).
28
29Note: the scanner doesn't perform lexical analysis or, in other words, it
30doesn't care about the token context. It is intended to be used by a
31lexer or parser.
32*/
33package scanner