Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » B3 » repository syntax
repository syntax [message #606991] Wed, 19 May 2010 08:08
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2498
Registered: July 2009
Senior Member
Have worked on the syntax of repository declaration. When Thomas and I
reviewed the original proposal, it became apparent that the various
initialization elements did not follow a common set of easily deductible
rules (it was more like "make it really easy to write what is most common").

So, I played around with some rules, the idea we had during the review was:
- Use ':' instead of '='
- Use ': singleValue' for single values
- Use '[ value, value]' for list
- Use '{ ... }' for compound

Sample
------
repositories {
cvs my_cvs_3 {
connection : "http://abc.org" ;
branches [
aBranchCalledWanda,
main {
timestamp : "20100516213854+0200";
update-policy : no-update;
include [ "some/path/or.complex.name",
"some/path/or.complex.name",
aName ];
exclude [ ~/.*/ ,
~/.*/,
my_name.exactly,
"some/path/or.complex.name"]; }
];
}
}
Having rewritten some of the previous syntax into this, I found several
things that I did not like - so here is take 2:

Take 2
------
- no grouping "repositories", just state them one after another, the
order is not important anyway.
- use more keywords (having a list of predicates where the
differentiator is if it is a regexp or not is not very readable (and
prevents the use of SimplePattern).
- instead of list with just "," between elements, repeat the keyword
(much easier to read, esp. when list is longer and elements are not uniform)
- Assignment (with ':' or '=') is unnecessary and mostly clutters the
specification. I found this to be quite irritating when using code
completion (an extra step always required before fully understanding
what the keyword stands for.
- each 'statement' ends with ';' for elements that have a single value,
and with '}' when a block is/can used. I.e. when a block can be used but
nothing is specified, the element ends with '{}' I think this is clearer
as it indicates that there is potentially more stuff, and since it is
empty there are some additional defaults. I think this is a good hint.

repository cvs my_cvs_4 {
connection "http://abc.org" ;
branch aBranchCalledWanda { }
branch aBranchAlsoCalledWanda { }
branch main {
timestamp "20100516213854+0200";
update-policy no-update;
include {
name "some/path/or.complex.name" ;
name aName ;
pattern "*.middle.*" ;
}
exclude {
pattern ~/.*apa/ ;
pattern ~/.*bepa/ ;
name aBadName;
}
}

I think is is more readable, esp, when there is no syntax coloring to
aid the reader.


Regards
- henrik
Previous Topic:new b3 version checked in - guice added and one more test green
Next Topic:repository syntax
Goto Forum:
  


Current Time: Tue Jul 29 19:04:30 EDT 2014

Powered by FUDForum. Page generated in 0.01804 seconds