#Iftrue (#version_number == 8);
Constant USEINFORM;
#Endif;

Constant Story      "Parser test";
Constant Headline   "^A parser test suite for PunyInform.^";
Serial "200827";


Constant INITIAL_LOCATION_VALUE = Library;

#Ifndef USEINFORM;
! Uncomment to show time instead of score/turns
!Statusline time;

Constant DEBUG;
!Constant DEBUG_PARSEANDPERFORM;
!Constant DEBUG_PARSEPATTERN;
!Constant DEBUG_PARSETOKEN;
!Constant DEBUG_PARSENOUNPHRASE;
!Constant DEBUG_GETNEXTNOUN;
!Constant DEBUG_SCOPE;

! Uncomment to add optional features to PunyLib
!Constant DEBUG;
!Constant CUSTOM_ABBREVIATIONS;
!Constant OPTIONAL_ALLOW_WRITTEN_NUMBERS;
Constant OPTIONAL_EXTENDED_METAVERBS;
Constant OPTIONAL_EXTENDED_VERBSET;
!Constant OPTIONAL_NO_DARKNESS;
!Constant OPTIONAL_FULL_SCORE;
!Constant OPTIONAL_FULL_DIRECTIONS;
Constant OPTIONAL_GUESS_MISSING_NOUN;
!Constant OPTIONAL_MANUAL_SCOPE;
!Constant RUNTIME_ERRORS = 0;
#EndIf;

#Ifdef USEINFORM;
Include "Parser";
Include "VerbLib";

#IfNot;
Include "globals.h";
#EndIf;

[ ChooseObjects obj code;
    if(obj == 0) return 1;
!print (the) obj," ",code, " ", action, " ", action_to_be, "^";
    if(code < 2) {
        ! considering including obj in "all", with
        ! code == true if wanting to add the obj
        if (obj has scenery) {
            ! force include (would normally be excluded)
            return 1;
        }
        rfalse; ! go with std parser decision
    }
    ! deciding between seemingly equally good matches
    if(action_to_be == ##Eat && obj has edible) return 3;
    if(obj hasnt scenery) return 2;
    return 1;
];

#Ifndef USEINFORM;
Include "puny.h";
#EndIf;

! Uncomment to add PunyLib extensions
!Include "ext_menu.h";
!Include "ext_flags.h";
!Include "ext_quote_box.h";
!Include "ext_cheap_scenery.h";

#Ifdef USEINFORM;
Include "Grammar";
#Endif;
Object Library "The Library"
	with
	    description "You are in a library.",
	has light;

Object -> John "John"
	with name 'john',
	description "He is beautiful and he knows it.",
	has animate proper;

Object -> BlackRod "black rod"
	with name 'black' 'rod',
	;

Object -> BlackCake "black cake"
	with name 'black' 'cake',
	before [;
	Eat: "You decide to leave it for later.";
	],
	has edible;

Object -> Shrubbery "shrubbery"
	with name 'shrubbery',
	has scenery;

[ Initialise;
#IfDef USEINFORM;
    location=INITIAL_LOCATION_VALUE;
#EndIf;
    ChooseObjects(0,0);
];
