<commit_before>/**
 * FaZend.com, Fully Automated Zend Framework
 * RQDQL.com, Requirements Definition and Query Language
 *
 * Redistribution and use in source and binary forms, with or 
 * without modification, are PROHIBITED without prior written 
 * permission from the author. This product may NOT be used 
 * anywhere and on any computer except the server platform of 
 * FaZend.com. located at www.fazend.com. If you received this 
 * code occasionally and without intent to use it, please report 
 * this incident to the author by email: <EMAIL>
 *
 * @author <NAME> <<EMAIL>>
 * @copyright Copyright (c) rqdql.com, 2010
 * @version $Id$
 */

// we should track locations of errors, in YYLTYPE, see lyyerror()
%locations

%{
    #include "rqdql.h"
    #include "Proxy.h"
    #include "Solm.h"
    #include "brokers.h"
	using boost::format;    
    using namespace proxy;
%}

// Here we should say that the type of non-terminal
// terms are mapped to %union.name, and are strings because of that
%type <name> words
%type <name> slotName
%type <name> objectName
%type <name> informal
%type <name> verb
%type <ptr> theClass
%type <ptr> classPath
%type <ptr> slots
%type <ptr> slot
%type <ptr> predicate
%type <ptr> invariant
%type <ptr> classDefinition
%type <ptr> useCaseDefinition
%type <ptr> invariantDeclaration
%type <ptr> slotsDeclaration
%type <ptr> useCaseDeclaration
%type <ptr> useCaseAlternativeDeclaration
%type <ptr> useCaseStarter
%type <ptr> signature
%type <ptr> sigElements
%type <ptr> sigElement
%type <ptr> de
%type <ptr> deType
%type <ptr> flows
%type <ptr> flow
%type <ptr> altId
%type <ptr> altIdPair


// Declaration of all known tokens
%token <name> QUOTED
%token <name> CAMEL
%token <name> QOS
%token <name> UC
%token <name> WORD
%token <num> NUMBER
%token <name> LETTER
%token <name> PREPOSITION

%token COLON SEMICOLON DOT COMMA STAR
%token AND OR
%token WHERE
%token SUD
%token SOMEBODY
%token SOMETHING
%token THE
%token OF
%token IF
%token SELF
%token PLURAL_MANY PLURAL_SOME PLURAL_ANY
%token OPEN_BRACE CLOSE_BRACE
%token IS_A
%token IS
%token INCLUDES

%nonassoc COMMA
%nonassoc AND
%nonassoc SEMICOLON
%nonassoc DOT
%nonassoc PREPOSITION
%left WORD
%left NUMBER
%right OF
%right COLON
%right INCLUDES

%%

srs:
    /* it can be empty */ 
    |
    srs statement 
    ;

statement:
    classDefinition  
    | 
    useCaseDefinition 
    |
    error
        {
            lyyerror(@1, "Statement ignored"); 
        }
    ;

classDefinition:
    invariantDeclaration |
    slotsDeclaration
    ;
    
useCaseDefinition:
    useCaseDeclaration |
    useCaseAlternativeDeclaration
    ;

/** 
 * Invariants... 
 */
invariantDeclaration:
    theClass IS_A invariant DOT 
        { 
            if (!$1) {
                lyyerror(@3, "You can't place HIMSELF to the left part of declaration");
            } else {
                Type* t = static_cast<Type*>($1);
                t->addPredicate(static_cast<solm::Formula*>($3));
                $$ = t;
                protocol(@1, $$);
            }
        } 
    ;
    
invariant:
    predicate <commit_msg>QOS will be parsed by bison properly<commit_after>/**
 * FaZend.com, Fully Automated Zend Framework
 * RQDQL.com, Requirements Definition and Query Language
 *
 * Redistribution and use in source and binary forms, with or 
 * without modification, are PROHIBITED without prior written 
 * permission from the author. This product may NOT be used 
 * anywhere and on any computer except the server platform of 
 * FaZend.com. located at www.fazend.com. If you received this 
 * code occasionally and without intent to use it, please report 
 * this incident to the author by email: <EMAIL>
 *
 * @author <NAME> <<EMAIL>>
 * @copyright Copyright (c) rqdql.com, 2010
 * @version $Id$
 */

// we should track locations of errors, in YYLTYPE, see lyyerror()
%locations

%{
    #include "rqdql.h"
    #include "Proxy.h"
    #include "Solm.h"
    #include "brokers.h"
	using boost::format;    
    using namespace proxy;
%}

// Here we should say that the type of non-terminal
// terms are mapped to %union.name, and are strings because of that
%type <name> words
%type <name> slotName
%type <name> objectName
%type <name> informal
%type <name> verb
%type <ptr> theClass
%type <ptr> classPath
%type <ptr> slots
%type <ptr> slot
%type <ptr> predicate
%type <ptr> invariant
%type <ptr> classDefinition
%type <ptr> useCaseDefinition
%type <ptr> invariantDeclaration
%type <ptr> slotsDeclaration
%type <ptr> useCaseDeclaration
%type <ptr> useCaseAlternativeDeclaration
%type <ptr> useCaseStarter
%type <ptr> signature
%type <ptr> sigElements
%type <ptr> sigElement
%type <ptr> de
%type <ptr> deType
%type <ptr> flows
%type <ptr> flow
%type <ptr> altId
%type <ptr> altIdPair


// Declaration of all known tokens
%token <name> QUOTED
%token <name> CAMEL
%token <name> QOS
%token <name> UC
%token <name> WORD
%token <num> NUMBER
%token <name> LETTER
%token <name> PREPOSITION

%token COLON SEMICOLON DOT COMMA STAR
%token AND OR
%token WHERE
%token SUD
%token SOMEBODY
%token SOMETHING
%token THE
%token OF
%token IF
%token SELF
%token PLURAL_MANY PLURAL_SOME PLURAL_ANY
%token OPEN_BRACE CLOSE_BRACE
%token IS_A
%token IS
%token INCLUDES

%nonassoc COMMA
%nonassoc AND
%nonassoc SEMICOLON
%nonassoc DOT
%nonassoc PREPOSITION
%left WORD
%left NUMBER
%right OF
%right COLON
%right INCLUDES

%%

srs:
    /* it can be empty */ 
    |
    srs statement 
    ;

statement:
    classDefinition  
    | 
    useCaseDefinition  
    | 
    qosDefinition 
    |
    error
        {
            lyyerror(@1, "Statement ignored"); 
        }
    ;

classDefinition:
    invariantDeclaration |
    slotsDeclaration
    ;
    
useCaseDefinition:
    useCaseDeclaration |
    useCaseAlternativeDeclaration
    ;

qosDefinition:
    QOS informal DOT
    ;
    
/** 
 * Invariants... 
 */
invariantDeclaration:
    theClass IS_A invariant DOT 
        { 
            if (!$1) {
                lyyerror(@3, "You can't place HIMSELF to the left part of declaration");
            } else {
                Type* t = static_cast<Type*>($1);
                t->addPredicate(static_cast<solm::Formula*>($3));
                $$ = t;
                protocol(@1, $$);
            }
        } 
    ;
    
invariant:
    predicate 
{'fraction_non_alphanumeric': 0.100619933237959, 'fraction_numerical': 0.0031791448100460975, 'mean_word_length': 3.1178010471204187, 'pattern_counts': {'":': 0, '<': 85, '<?xml version=': 0, '>': 87, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3421054', 'n_tokens_mistral': 2144, 'n_tokens_neox': 2014, 'n_words': 701}