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 modules, 21 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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