scanner

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 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 {
	token.FileInfo
	// contains filtered or unexported fields
}

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