mapss.dif.util
Class Conventions

java.lang.Object
  extended by mapss.dif.util.Conventions

public class Conventions
extends java.lang.Object

This class includes static methods for convention checks in synthesis tree classes. If there is a common convention for similar parameters of different classes, related checks can be placed to this class to avoid code duplication.

Version:
$Id: Conventions.java 362 2007-02-25 21:08:57Z plishker $
Author:
Fuat Keceli

Constructor Summary
protected Conventions()
           
 
Method Summary
static java.lang.String datatypeConvention(java.lang.String label)
          Type convention check for DIF actor attribute type.
static java.lang.String labelConvention(java.lang.String label)
          Label convention check for using with data structures that require element labels such as Hierarchy or DIFGraph.
static void main(java.lang.String[] args)
           
static java.lang.String typeConvention(java.lang.String label)
          Type convention check for DIF actor attribute type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Conventions

protected Conventions()
Method Detail

main

public static void main(java.lang.String[] args)

labelConvention

public static java.lang.String labelConvention(java.lang.String label)
Label convention check for using with data structures that require element labels such as Hierarchy or DIFGraph. Following is the definition for strings acceptable by this method:
        digit = ['0' .. '9']
        non_digit = [[['a' .. 'z'] + ['A' .. 'Z']] + '_']
        s_char = [all -['"' + ['\' + [10 + 13]]]] | escape_sequence;
        s_char_sequence = s_char*;

        label = non_digit (digit | non_digit)*
        or
        label = '$' s_char_sequence '$';
        
This definition is compatible with DIF Language definition in mapss/dif/language/sablecc/Compiler.grammar.

Parameters:
label - String to check.
Returns:
Error string. Null in case of no errors.

typeConvention

public static java.lang.String typeConvention(java.lang.String label)
Type convention check for DIF actor attribute type. Note that '$' s_char_sequence '$' is not allowed in this method. Following is the definition for strings acceptable by this method:
        digit = ['0' .. '9']
        non_digit = [[['a' .. 'z'] + ['A' .. 'Z']] + '_']
        label = non_digit (digit | non_digit)* ('.' non_digit (digit | non_digit)* )*;
        

Parameters:
label - String to check.
Returns:
Error string. Null in case of no errors.

datatypeConvention

public static java.lang.String datatypeConvention(java.lang.String label)
Type convention check for DIF actor attribute type. Note that '$' s_char_sequence '$' is not allowed in this method. Following is the definition for strings acceptable by this method:
        digit = ['0' .. '9']
        non_digit = [[['a' .. 'z'] + ['A' .. 'Z']] + '_']
        label = non_digit (digit | non_digit)* ('.' non_digit (digit | non_digit)* )*;
        

Parameters:
label - String to check.
Returns:
Error string. Null in case of no errors.