# This file is part of TagSoup and is Copyright 2002-2008 by John Cowan.
#
# TagSoup is licensed under the Apache License,
# Version 2.0.  You may obtain a copy of this license at
# http://www.apache.org/licenses/LICENSE-2.0 .  You may also have
# additional legal rights not granted by this license.
#
# TagSoup is distributed in the hope that it will be useful, but
# unless required by applicable law or agreed to in writing, TagSoup
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
# OF ANY KIND, either express or implied; not even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# State Table Markup Language
default namespace = "http://www.ccil.org/~cowan/XML/tagsoup/stml"
start = statetable

## Root element
statetable = element statetable {
	attribute version {"1.0"},
	attribute id {xsd:ID}?,
	symbol*,
	action+,
	state+
	}

## A symbol specifies a non-character input to the state machine
symbol = element symbol {
	attribute id {xsd:ID}
	}

## An action is the name for what the state machine does
action = element action {
	attribute id {xsd:ID}
	}

## A state specifies an internal state of the machine
state = element state {
	attribute id {xsd:ID},
	tr*
	}

## A tr specifies a state transition
tr = element tr {
	(attribute symbol {xsd:IDREF} |
		attribute char {xsd:string {length = "1"}}),
	attribute action {xsd:IDREF},
	attribute newstate {xsd:IDREF}
	}
