Skip to content

Commit

Permalink
Updated test.pmf and Notepad++ definition. Also added parts of the ne…
Browse files Browse the repository at this point in the history
…w PorkScript grammar.

Definitions updated to add lists.
  • Loading branch information
brennana committed Sep 18, 2012
1 parent 60a8721 commit 9996faa
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 2 deletions.
1 change: 1 addition & 0 deletions GameContainer/GameContainer.vcxproj
Expand Up @@ -83,6 +83,7 @@
<ClInclude Include="PItemListItem.h" />
<ClInclude Include="PMap.h" />
<ClInclude Include="PorkString.h" />
<ClInclude Include="PProperty.h" />
<ClInclude Include="PState.h" />
</ItemGroup>
<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions GameContainer/GameContainer.vcxproj.filters
Expand Up @@ -51,6 +51,9 @@
<ClInclude Include="PorkString.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PProperty.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="PBaseEntity.cpp">
Expand Down
56 changes: 56 additions & 0 deletions GameContainer/PProperty.h
@@ -0,0 +1,56 @@
/***********************************************************************
PorkScript Game Engine (C) 2012 Andy J. Brennan
PProperty.h -- Header file that defines the PProperty class. This class
holds a boost::any and other property information
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
PorkScript on GitHub: https://github.com/valdez42/porkscript/
*************************************************************************/

#ifndef _PPROPERTY_H
#define _PPROPERTY_H

#include <boost\variant.hpp>
#include <string>
#include <vector>
#include <map>

using std::string;
using std::map;
using std::vector;

namespace GameContainer
{
typedef boost::variant<long, string, bool, vector<long>, vector<string>, vector<bool>> PVariant;

class PProperty
{
public:
PProperty(string name, PVariant value);
~PProperty();

void SetDynVersion(PVariant ident, PVariant value);

private:
string itsName;
string itsModule;
PVariant itsValue;
map<PVariant, PVariant> dynVersions;
};
}

#endif
2 changes: 2 additions & 0 deletions PorkParser/PorkParser.cpp
Expand Up @@ -184,5 +184,7 @@ pork_grammar::pork_grammar():
using phoenix::construct;
using phoenix::val;

quoted_string %= lexeme['"' >> +(char_ - '"') >> '"'];


}
11 changes: 11 additions & 0 deletions PorkParser/PorkParser.h
Expand Up @@ -130,10 +130,21 @@ namespace PorkParserSpace
vector<TempParseInfo> maps;
};

// Boost.Fusion structure adaptations for Spirit.Qi

// TempGC
BOOST_FUSION_ADAPT_STRUCT(
TempGC,
(vector<TempParseInfo>, items)
(vector<TempParseInfo>, maps)
);

template <typename Iterator>
struct pork_grammar: qi::grammar<Iterator, TempGC(), qi::locals<std::string>, ascii::space_type>
{
pork_grammar();

qi::rule<Iterator, std::string(), ascii::space_type> quoted_string;
};

// Class PorkParser -- represents the .pmf parser + parsed information used in Pork
Expand Down
2 changes: 1 addition & 1 deletion PorkParser/PorkScript.xml
Expand Up @@ -11,7 +11,7 @@
<Keywords name="Folder-"></Keywords>
<Keywords name="Operators">&quot; ( ) , . : [ ] +</Keywords>
<Keywords name="Comment">1 1 2 2 0#</Keywords>
<Keywords name="Words1">set def edef requires dynamic default edyn state true false eset reliesOn from default trigger present n_present inf for definitive as</Keywords>
<Keywords name="Words1">set def edef requires dynamic default edyn state true false eset reliesOn from default trigger present n_present inf for definitive as in</Keywords>
<Keywords name="Words2">name desc map item craft itemlist itemDTag</Keywords>
<Keywords name="Words3">curItemAmt p</Keywords>
<Keywords name="Words4"></Keywords>
Expand Down
14 changes: 13 additions & 1 deletion PorkParserWin/test.pmf
Expand Up @@ -3,6 +3,7 @@ requires murder
requires get
requires detonate
requires basic
requires teleport

def map mPuddle:
set name "Puddle"
Expand All @@ -14,6 +15,12 @@ def map mPuddle:
banana
something
eset
set teleport.locations:
mChina[2] # As much as this context makes little sense, it is still possible.
mGreg #These can also use the conditional statements if they are in a state
mHouse
mWhatever
eset
set dir.n mPlace
set dir.s mMountain
set dir.d mAnotherPlace
Expand All @@ -26,6 +33,11 @@ def map mMountain:
set itemlist anotherItem[5], kack, whatsit[inf]
set dir.s mChurch
set dir.e mValley
set detonate.shrapnel:
iShrap1[7]
iShrap2[2]
iDiamond
eset
set dynamic detonate.msg "You asploded mah mountain!":
iC4Bomb "You asploded mah mountain with C4!"
eset
Expand All @@ -34,7 +46,7 @@ def map mMountain:
set name "Destroyed Mountain"
set desc "Oh noes!"
set itemlist:
potato reliesOn kack from default as present
potato reliesOn kack from default in itemlist as present
something[3] # Put three of this object in the world
whatever[inf] # Put an infinite amount of objects in world
eset
Expand Down

0 comments on commit 9996faa

Please sign in to comment.