btwael / mammouth

Unfancy PHP
http://mammouth.boutglay.com
MIT License
214 stars 22 forks source link

key-based (associative) arrays #11

Closed CezaryDanielNowak closed 10 years ago

CezaryDanielNowak commented 10 years ago

Hey, it looks like, there is no way to make key-based arrays. I suggest to make it work like that:

colors = [
  'chars': 'grey'
  'keywords': 'blue'
  'joins': 'gray'
  'functions': 'violet'
  'constants': 'red'
]

compile to:

$colors = array(
  'chars' => 'grey',
  'keywords' => 'blue',
  'joins' => 'gray',
  'functions' => 'violet',
  'constants' => 'red'
);
btwael commented 10 years ago

see this example: http://mammouth.wamalaka.com/#try:{{%0Acolors%20%3D%20[%0A%20%20%27chars%27%3A%20%27grey%27%2C%0A%20%20%27keywords%27%3A%20%27blue%27%2C%0A%20%20%27joins%27%3A%20%27gray%27%2C%0A%20%20%27functions%27%3A%20%27violet%27%2C%0A%20%20%27constants%27%3A%20%27red%27%2C%0A%20%2012%3A%20%27hello%27%2C%0A%20%20var1%0A]%0A}}

CezaryDanielNowak commented 10 years ago

super cool!