Module otpcl

One-stop shop for all your OTPCL needs.

Behaviours: application.

Description

One-stop shop for all your OTPCL needs.

The otpcl module re-exports various functions for convenience when using OTPCL from within other OTP applications.

Data Types

column_no()

column_no() = integer()

eval_error()

eval_error() = {error, reason(), state()}

eval_input()

eval_input() = string() | binary() | [token()]

eval_success()

eval_success() = {ok, state()}

filename()

filename() = any()

funs()

funs() = map()

level()

level() = atom()

line_no()

line_no() = integer()

parse_error()

parse_error() = {error, reason(), level(), [token()], [tree()]}

parse_success()

parse_success() = {ok, tree(), [token()]}

position()

position() = {filename(), line_no(), column_no()}

reason()

reason() = atom() | {atom(), any()}

state()

state() = {funs(), vars()}

str_or_bin()

str_or_bin() = string() | binary()

token()

token() = {char(), position()}

tree()

tree() = {parsed, level(), [tree()] | [token()]}

vars()

vars() = map()

Function Index

cmd/2Get the function backing a command from an OTPCL interpreter state.
cmd/3Set the function backing a command in an OTPCL interpreter state.
eval/1Interpret a (charlist/binary/token) string as an OTPCL program with the default starting state.
eval/2Interpret a (charlist/binary/token) string as an OTPCL program with a custom starting state.
eval_file/1Interpret the contents of a file as an OTPCL program with the default starting state.
eval_file/2Interpret the contents of a file as an OTPCL program with a custom starting state.
get/2Get the value of a variable from an OTPCL interpreter state.
import/2Import all the functions from a module into an OTPCL interpreter state.
import/3Import a specific function from a module into an OTPCL interpreter state.
interpret/1Interpret an OTPCL parse tree with the default starting state.
interpret/2Interpret an OTPCL parse tree with a custom starting state.
parse/1Parse a (charlist/binary/token) string as an OTPCL program.
scan/1Convert a charlist string or binary string into a token string.
scan/2Convert a charlist string or binary string into a token string.
set/3Set the value of a variable in an OTPCL interpreter state.

Function Details

cmd/2

cmd(Name::atom(), State::state()) -> {function(), state()}

Get the function backing a command from an OTPCL interpreter state.

cmd/3

cmd(Name::atom(), Fun::function(), State::state()) -> {ok, state()}

Set the function backing a command in an OTPCL interpreter state.

eval/1

eval(Src::eval_input()) -> eval_success() | eval_error()

Interpret a (charlist/binary/token) string as an OTPCL program with the default starting state.

eval/2

eval(Src::eval_input(), State::state()) -> eval_success() | eval_error()

Interpret a (charlist/binary/token) string as an OTPCL program with a custom starting state.

eval_file/1

eval_file(Filename::filename()) -> eval_success() | eval_error()

Interpret the contents of a file as an OTPCL program with the default starting state.

eval_file/2

eval_file(Filename::filename(), State::state()) -> eval_success() | eval_error()

Interpret the contents of a file as an OTPCL program with a custom starting state.

get/2

get(Name::atom(), State::state()) -> {any(), state()}

Get the value of a variable from an OTPCL interpreter state.

import/2

import(Module::atom(), State::state()) -> {ok, state()} | {{ok, atom()}, state()}

Import all the functions from a module into an OTPCL interpreter state.

import/3

import(Module::atom(), Fun::atom(), State::state()) -> {ok, state()} | {{ok, atom()}, state()}

Import a specific function from a module into an OTPCL interpreter state.

interpret/1

interpret(Tree::tree()) -> eval_success() | eval_error()

Interpret an OTPCL parse tree with the default starting state.

interpret/2

interpret(Tree::tree(), State::state()) -> eval_success() | eval_error()

Interpret an OTPCL parse tree with a custom starting state.

parse/1

parse(Src::eval_input()) -> parse_success() | parse_error()

Parse a (charlist/binary/token) string as an OTPCL program.

scan/1

scan(Txt::str_or_bin()) -> [token()]

Convert a charlist string or binary string into a token string. The resulting tokens will start from the default starting position ({nofile,0,0}).

scan/2

scan(Txt::str_or_bin(), Pos::position()) -> [token()]

Convert a charlist string or binary string into a token string. The resulting tokens will start from the starting position Pos.

set/3

set(Name::atom(), Val::any(), State::state()) -> {ok, state()}

Set the value of a variable in an OTPCL interpreter state.


Generated by EDoc