scanner

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

README

scanner

A text scanner utility/

Documentation

Overview

Copyright 2021 Lee R. Boynton

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const BLACK = "\033[0;0m"
View Source
const BLUE = "\033[94m"
View Source
const GREEN = "\033[92m"
View Source
const RED = "\033[0;31m"
View Source
const YELLOW = "\033[0;33m"

Variables

This section is empty.

Functions

func FormattedAnnotation

func FormattedAnnotation(filename string, source string, prefix string, msg string, tok *Token, color string, contextSize int) string

func IsDigit

func IsDigit(ch rune) bool

func IsLetter

func IsLetter(ch rune) bool

func IsLowercaseLetter

func IsLowercaseLetter(ch rune) bool

func IsSymbolChar

func IsSymbolChar(ch rune, first bool) bool

func IsUppercaseLetter

func IsUppercaseLetter(ch rune) bool

func IsWhitespace

func IsWhitespace(ch rune) bool

Types

type Scanner

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

func NewScanner

func NewScanner(r io.Reader) *Scanner

func (*Scanner) Scan

func (s *Scanner) Scan() Token

type Token

type Token struct {
	Type  TokenType
	Text  string
	Line  int
	Start int
}

func (Token) IsNumeric

func (tok Token) IsNumeric() bool

func (Token) IsText

func (tok Token) IsText() bool

func (Token) String

func (tok Token) String() string

type TokenType

type TokenType int
const (
	UNDEFINED TokenType = iota
	EOF
	LINE_COMMENT
	BLOCK_COMMENT
	SYMBOL
	NUMBER
	STRING
	COLON
	SEMICOLON
	COMMA
	AT
	DOT
	EQUALS
	DOLLAR
	QUOTE
	SLASH
	QUESTION
	OPEN_BRACE
	CLOSE_BRACE
	OPEN_BRACKET
	CLOSE_BRACKET
	OPEN_PAREN
	CLOSE_PAREN
	OPEN_ANGLE
	CLOSE_ANGLE
	NEWLINE
	HASH
	AMPERSAND
	STAR
	BACKQUOTE
	TILDE
	BANG
)

func (TokenType) String

func (tokenType TokenType) String() string

Jump to

Keyboard shortcuts

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