Hi,
I am not sure what you mean when you say an object that knows how to add to the result. Basically, you would need to build for each production the object and collect the meaningful ones in the outer scope.
Here is something that would work for your example:
a := 'AAA' asParser ==> [:token | #a].
b := 'BBB' asParser ==> [:token | #b].
c := 'CCC' asParser ==> [:token | #c].
meaningful := a / b / c.
other := (meaningful / #newline asParser) negate star flatten.
log := (meaningful / other) delimitedBy: #newline asParser.
result := log end parse: 'AAA
AAA
BBB
CCC
AAA
other text
CCC
BBB
other text'.
result select: #isSymbol
I am CC-ing the moose mailing list because these questions tend to find better answers there.
Cheers,
Doru
On May 27, 2013, at 11:07 PM, Juan Ignacio Vaccarezza <juanvaccarezza(a)gmail.com> wrote:
> Hi all,
>
> First of all thanks for the amazing work and aswers to all. Having said that, the problem:
>
> I need to parse a log, a model that represents the lo is the following:
>
> '
> AAA
> AAA
> BBB
> Line I don't care which can contain anything that is not AAA BBB or CCC
> CCC
> AAA
> CCC
> BBB
> Line I don't care which can contain anything that is not AAA BBB or CCC
> '
>
> I manage to write the grammar which parses this, but then I would lilke to have all the log info digested on a result object which behaves something like this:
>
> resutlObject as size --> 3
> resultObject bs size --> 2
> restulIbject cs size -->2
>
> The option that im using now is that individual parsers (meaning the parser for AAA,BBB,CCC,etc) actually retunrs an object that knows how to add themselves to the result and then, I iterate over the parser's array result asking to each object to add itself to the result.
>
> Is there a better solution?
>
> Thanks to all,
> Juan.
--
www.tudorgirba.com
"It's not how it is, it is how we see it."
See <https://ci.inria.fr/moose/job/moose-latest-dev-4.8/524/>
------------------------------------------
Started by timer
Started by upstream project "fame" build number 76
originally caused by:
Started by timer
Started by upstream project "glamour" build number 119
originally caused by:
Started by timer
Started by upstream project "gtoolkit" build number 109
originally caused by:
Started by timer
Building remotely on moose-slave in workspace <https://ci.inria.fr/moose/job/moose-latest-dev-4.8/ws/>
Deleting project workspace... done
[moose-latest-dev-4.8] $ /bin/sh -xe /tmp/hudson7440857360844265151.sh
+ bash
+ wget --quiet -O - http://get.pharo.org/20+vmLatest
Downloading the latest 20 Image:
http://files.pharo.org/image/20/latest.zip
Pharo.image
Downloading the latest pharoVM:
http://files.pharo.org/vm/pharo/linux/pharo-linux-latest.zip
pharo-vm/pharo
Downloading PharoV10.sources:
http://files.pharo.org/image//PharoV10.sources.zip
Downloading PharoV20.sources:
http://files.pharo.org/image//PharoV20.sources.zip
Creating starter scripts pharo and pharo-ui
Please install the 32bit libraries
sudo aptitude install ia32-libs
+ ./pharo Pharo.image save moose-latest-dev-4.8
+ REPO=http://www.smalltalkhub.com/mc/Moose/Moose/main
+ ./pharo moose-latest-dev-4.8.image config http://www.smalltalkhub.com/mc/Moose/Moose/main ConfigurationOfMoose --install=development
[31m[33m
===============================================================================
Notice: Installing ConfigurationOfMoose development
===============================================================================
[0m[0m+ ./pharo moose-latest-dev-4.8.image mooseimagesetup
+ ./pharo moose-latest-dev-4.8.image moosetest --junit-xml-output
[31m[33m
===============================================================================
Notice: Running tests in 132 Packages
===============================================================================
[0m[0m[31mError: index out of range
[0mTabSelectorMorph(Object)>>error:
TabSelectorMorph(Morph)>>privateAddAllMorphs:atIndex:
TabSelectorMorph(Morph)>>addAllMorphs:
TabSelectorMorph>>updateTabs
TabSelectorMorph>>extent:
TabSelectorMorph(Morph)>>bounds:
TabSelectorMorph(Morph)>>layoutInBounds:
TableLayout>>layoutLeftToRight:in:
TableLayout>>layout:in:
PanelMorph(Morph)>>doLayoutIn:
PanelMorph(Morph)>>fullBounds in Block: [self doLayoutIn: self layoutBounds]
BlockClosure>>on:do:
PanelMorph(Morph)>>fullBounds
LazyTabGroupMorph(Morph)>>submorphBounds in Block: [:m | | subBox | m visible...
Array(SequenceableCollection)>>do:
LazyTabGroupMorph(Morph)>>submorphBounds
LazyTabGroupMorph(Morph)>>privateFullBounds
LazyTabGroupMorph(Morph)>>doLayoutIn:
LazyTabGroupMorph(Morph)>>fullBounds in Block: [self doLayoutIn: self layoutBounds]
BlockClosure>>on:do:
LazyTabGroupMorph(Morph)>>fullBounds
LazyTabGroupMorph(Morph)>>layoutProportionallyIn:
ProportionalLayout>>layout:in: in Block: [:m | m layoutProportionallyIn: newBounds]
Array(SequenceableCollection)>>do:
PanelMorph(Morph)>>submorphsDo:
ProportionalLayout>>layout:in:
PanelMorph(Morph)>>doLayoutIn:
PanelMorph(Morph)>>fullBounds in Block: [self doLayoutIn: self layoutBounds]
BlockClosure>>on:do:
PanelMorph(Morph)>>fullBounds
[0mBuild step 'Execute shell' marked build as failure
Archiving artifacts
Recording test results
ERROR: Failed to archive test reports
hudson.util.IOException2: remote file operation failed: <https://ci.inria.fr/moose/job/moose-latest-dev-4.8/ws/> at hudson.remoting.Channel@4ce1e2b3:moose-slave
at hudson.FilePath.act(FilePath.java:848)
at hudson.FilePath.act(FilePath.java:825)
at hudson.tasks.junit.JUnitParser.parse(JUnitParser.java:87)
at hudson.tasks.junit.JUnitResultArchiver.parse(JUnitResultArchiver.java:122)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:134)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:810)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:785)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:732)
at hudson.model.Run.execute(Run.java:1568)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
Caused by: hudson.util.IOException2: Failed to read <https://ci.inria.fr/moose/job/moose-latest-dev-4.8/ws/Glamour-Tests-Morphic…>
at hudson.tasks.junit.TestResult.parse(TestResult.java:244)
at hudson.tasks.junit.TestResult.parse(TestResult.java:163)
at hudson.tasks.junit.TestResult.parse(TestResult.java:140)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:116)
at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:117)
at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:90)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2309)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
Caused by: org.dom4j.DocumentException: Error on line 109 of document file://<https://ci.inria.fr/moose/job/moose-latest-dev-4.8/ws/Glamour-Tests-Morphic…> : XML document structures must start and end within the same entity. Nested exception: XML document structures must start and end within the same entity.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.dom4j.io.SAXReader.read(SAXReader.java:264)
at hudson.tasks.junit.SuiteResult.parse(SuiteResult.java:129)
at hudson.tasks.junit.TestResult.parse(TestResult.java:227)
... 15 more
Caused by: org.xml.sax.SAXParseException; systemId: file://<https://ci.inria.fr/moose/job/moose-latest-dev-4.8/ws/Glamour-Tests-Morphic…;> lineNumber: 109; columnNumber: 1; XML document structures must start and end within the same entity.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:391)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1404)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.endEntity(XMLDocumentFragmentScannerImpl.java:882)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.endEntity(XMLDocumentScannerImpl.java:582)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.endEntity(XMLEntityManager.java:1370)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1740)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipChar(XMLEntityScanner.java:1393)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2769)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:819)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:748)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1208)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:525)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
... 18 more
Hello,
I have made changes to the PetitJava package (in a local directory - in
interim steps I broke a lot of tests),and would not like to share it back
out in the correct repository.
I am unable to actually load anything to SmalltalkHub (PetitJava)
repository at all, however. If I setup the Monticello configuration with
no login information, I get a 403 error returned. If I set it up with my
login credentials, I get a 500 error returned instead.
If I need to be added to this project, could someone please add me?
thanks,
Chris Cunningham
Hi Jan,
Please do not forget to let us know when you have merged your nice First and Follow modifications to PetitParser.
Also, regarding the inspector and visualization, please feel free to commit them as well as extensions to GTInspector.
Cheers,
Doru
--
www.tudorgirba.com
"Every thing has its own flow."
Hi,
i loaded Spy into a fresh Pharo 2.0 image.
After adding new packages to the image, the Hapao Wizard does not show these
newly added packages.
Should i submit a bug at the moose-technology google issue tracker?
M.
--
View this message in context: http://forum.world.st/Hapao-Wizard-does-not-show-newly-added-packages-tp468…
Sent from the Moose mailing list archive at Nabble.com.
Dear all,
I have submitted a gsoc project called SciSmalltalk. This is a new
Smalltalk project, similar to existing scientific libraries like
NumPy, SciPy for Python or SciRuby for Ruby. SciSmalltalk already
provide basic functionalities under MIT licence: complex and
quaternions extensions, random number generator, fuzzy algorithms,
LAPACK linear algebra package, Didier Besset's numerical methods, ...
We want to extend SciSmalltalk to solve ODE (Ordinary Differential
Equations).
I you are a gsoc mentors, I would like to encourage you to give your
vote to this project !
I believe this really important if we want to offer new alternatives
for people who want to made science, mathematics, statistics and big
data with Smalltalk !
The student for this project is very capable, because she is a
mathematician student. We definitively need to support girls
involvement in Smalltalk development and computer science !
Thank you.
Regards,
--
Serge Stinckwich
UCBN & UMI UMMISCO 209 (IRD/UPMC)
Every DSL ends up being Smalltalk
http://www.doesnotunderstand.org/