Skip to content

Css tokenizer following W3C Syntax Module Level 3.

License

Notifications You must be signed in to change notification settings

hitoshi44/tokenizecss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tokenizecss

Css tokenizer following W3C Syntax Module Level 3. This module works almost OK, but may have some bugs, and needs more tests. PRs are wellcome!

Usage

Open css file with TokenizerObject

var tkz: CssTokenizer
tkz.open("./a.css")

To write out token data as a string, you can use "str" proc defined in "src/hepler".

import tokenizecss/helper

while tkz.kind != cssEOF:
  someTargetObject.add ( tkz.str )
  tkz.next()

If you want catch and tokenize comment, CssTokenizer.open with readComment option = true.

import tokenizecss

var tokenizer: CssTokenizer
tokenizer.open("./target.css", readComment = true)

import tokenizecss/helper
while tokenizer.kind != cssEOF:
  if tokenizer.kind == cssComment:
    echo tokenizer.str

# Tokenizer Object

```nim
CssTokenizer* = object of BaseLexer
  kind*: CssTokenKind
  flag*: CssTypeFlag
  strVal*: string
  intVal*: int
  fltVal*: float
  chrVal*: char
  temp*  : string
  readComment*: bool
  filename*: string

About

Css tokenizer following W3C Syntax Module Level 3.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published