Print Page | Close Window

MERL primer for oAW Xpand users

Printed From: MetaCase
Category:
Forum Name: MetaEdit+
Forum Description: All topics relating to MetaEdit+ or DSM
URL: https://www.metacase.com/forums/forum_posts.asp?TID=116
Printed Date: 27.Mar.2026 at 02:14
Software Version: Web Wiz Forums 12.05 - http://www.webwizforums.com


Topic: MERL primer for oAW Xpand users
Posted By: stevek
Subject: MERL primer for oAW Xpand users
Date Posted: 28.Aug.2009 at 17:53

MERL and openArchitectureWare's Xpand languages are rather similar in approach and functionality. The main differences are in syntax and keywords, so learning one if you know the other is easy. Here's a quick primer of how to translate from Xpand to MERL, with comments after the respective row where necessary.

Xpand MERL
SomeFixedText 'SomeFixedText'
«SOMECOMMAND» SOMECOMMAND
In XPand commands are quoted, whereas in MERL fixed text is quoted.
«DEFINE foo ... ENDDEFINE» Report 'foo' ... EndReport
In MERL, each report is defined on its own, not with several reports one after another in a single text.
Each report is defined on a particular Graph type (or the supertype of all, Graph itself).
«FILE Name + ".java" ... ENDFILE» filename :Name '.java' write ... close
«EXPAND foo FOREACH Bar» foreach .Bar { subreport 'foo' run }
You don't need to define a subreport, you can just put the commands from foo in the {}.
This often makes more sense, e.g. if you're not going to call foo from elsewhere.
 
foreach is for navigation from a graph to its elements.
For navigation between elements use "do" or "dowhile" (which covers SEPARATOR):
«EXPAND foo FOREACH Bar» do .Bar { subreport 'foo' run }
«EXPAND foo FOREACH Bar SEPARATOR ","» dowhile .Bar { subreport 'foo' run ','}
«this.name» :name
«LET ... AS var ..<var>.. ENDLET» variable 'var' write ... close ..$var..
For assignments with a single element on the right-hand side, you can use the shorter form: $var = 'foo', $var = :foo etc.
«REM...ENDREM» /*...*/
«PROTECT ID ... ... ENDPROTECT» md5id ... md5block ... md5sum
«CSTART ... CEND ...» filename 'bar.java'
md5start ... md5stop ...
merge .. .. .. close
The start and end sequences are specified in the filename command, since they will be the same for the whole file
«this.name.toUpper()» :Name%upper
For text manipulation, e.g. with Java in oAW, you can use MERL http://www.metacase.com/support/45/manuals/mwb/Mw-5_3_6.html#_Ref190594241 - translators . Many are defined in _translators, such as %upper a-z A-Z, and you can define your own to convert any combination of characters, strings and regular expressions.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.05 - http://www.webwizforums.com
Copyright ©2001-2022 Web Wiz Ltd. - https://www.webwiz.net