scanner

package
v0.1.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2016 License: Apache-2.0 Imports: 5 Imported by: 9

Documentation

Overview

Package scanner is the lexical parser.

Example
package main

import (
	"fmt"

	"github.com/NeowayLabs/nash/scanner"
)

func main() {
	lex := scanner.Lex("-input-", `echo "hello world"`)

	for tok := range lex.Tokens {
		fmt.Println(tok)
	}

}
Output:

IDENT
STRING
;
EOF

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lexer

type Lexer struct {
	Tokens chan Token // channel of scanned tokens
	// contains filtered or unexported fields
}

Lexer holds the state of the scanner

func Lex

func Lex(name, input string) *Lexer

type Token

type Token struct {
	// contains filtered or unexported fields
}

func (Token) Column

func (i Token) Column() int

func (Token) Line

func (i Token) Line() int

func (Token) Pos

func (i Token) Pos() token.Pos

func (Token) String

func (i Token) String() string

func (Token) Type

func (i Token) Type() token.Token

func (Token) Value

func (i Token) Value() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL