Java Syntax Analyser

Basically i am trying to make a java syntax analyser and there is one problem i am haing with the StreamTokenizer.
when the streamtokenizer reads a token it takes a whole string such as blah.blah.blah
but i want it to take on the first blah and then think that the '.' is a whitespace
is there any way of doing this.
also i tried using string.split(".") stuff but it seems that it regards the . as a termination character or something
can you answer some of these questions. thank you
regards
alpha

Oh, sorry, you asked for StreamTokenizer, not String Tokenizer. With Streamtokenizer, you can call
          tokenizer.whitespaceChars('.', '.');
With that method, you can declare a range of characters as whitespace characters.
Regards
Der Hinterwaeldler

Similar Messages

  • What is new in Java syntaxes in new Java versions?

    What is new in Java syntaxes in new Java versions?
    What about this sentenses
    1. for (int c:data), where data is array of integer
    2. ArrayList<Object> () ...
    3. Class<?>...
    I can't find this syntaxes in my books and documentation...
    And what Java version is latest?

    dont crosspost
    Edited by language police

  • New improvement for Java syntax

    Hi developers
    I develop in java each day and the new project that I am envolved uses too much multithreading. So i thought that a litle improvement could be made on java syntax.
    When two threads uses the same class attribute we must synchronize the access to this.
    class myClass {
    private int myAtribute = 0;
    thread1: We must access the attribute synchronized....
    shynchronized (this) {
    myAttribute = 1;
    thread2: The same....
    synchronized (this) {
    myAttribute = 3;
    thread2: But if i don't care.... :-(
    myAttribute = 4;
    Ok, that is the problem.
    I thought to solve this the java language must give us the chance to declare attributes in the way...
    private synchronize int myAttribute = 0;
    to be only accesed by sinchronized methods or by synchronized blocks in order to force interpreter to check if any method access this attribute without being synchronized in compiling time.

    In your example, wouldn't the volatile keyword normally suffice?
    private volatile int myAttribute = 0;Graeme

  • Java syntax in vim

    can somebody help me set up correctly a java syntax in vim?
    what files should be changed? it seems like the default syntax is for c/c++.
    thx

    try ":help syntax"

  • Java "Syntax" should be a main button.

    So I really like the idea of the new syntax and such, but I think it's annoying that 1.  I have to go to "advanced" reply to use "Java" syntax, and just having to click and scroll to it can be annoying(even though it takes 10 seconds.as it
    ImO I loved being able to do {code}{code} as it was fast and easy, so something like that would be cool, or just having the little Java button on top.  Is tables really more important than Java Syntax on a Java forum?
    Thanks for the forum!

    For a radio button group called 'frequency' where the value binding is
    1 - weekly
    2 - bi-weekly
    3 - monthly
    4 - annual
    you could add the following client-side JavaScript to the 'frequency' change event.
    var frequency = form1.subform1.frequency.rawValue;
    switch (frequency) {
    case "1":
    form1.subform1.annual.rawValue = form1.subform1.pay.rawValue * 52;
    break;
    case "2":
    form1.subform1.annual.rawValue = form1.subform1.pay.rawValue * 26;
    break;
    case "3":
    form1.subform1.annual.rawValue = form1.subform1.pay.rawValue * 12;
    break;
    case "4":
    form1.subform1.annual.rawValue = form1.subform1.pay.rawValue * 1;
    break;
    default:
    break;
    Steve

  • Where can I find a Java Syntax Highlighting TextArea?

    Where can I find a Java Syntax Highlighting TextArea?
    I'm currently only aware of JEdit and Netbeans being open source projects containing textarea components.
    BTW can code from the above projects be used in a project of my own?

    I have a syntax highlighting package (open source, GPL):
    http://ostermiller.org/syntax/
    It comes with a demonstration editor a tutorial:
    http://ostermiller.org/syntax/editor.html

  • Why the JavaFX syntax not closer to the Java syntax?

    I wonder why the JavaFX syntax is not closer to Java syntax than it is now?
    For example why
    public function myFunction(param: Integer): String[]
    is not simply
    public String[] myFunction(Integer param)
    After all in JavaFX there is also the word Java :)

    Somehow, I am more "shocked" by the usage of "script" name for JavaFX programs, since we don't really script an application (original sense of the word).It's certainly possible to have a long discussion about whether JavaFX Script is or is not a "scripting language". Unlike other scripting languages (e.g. JavaScript and Python come to mind, but there are many other possibilities) JavaFX Script is not interpreted directly nor is it dynamically typed. However, several features of the language do make JavaFX Script convenient for casual programming. For example, for simple programs it's not necessary to declare the types of variables, as they can (usually) be inferred by the compiler. Also, it's possible to code statements (really, expressions) "loose" in a plain file, without verbose class declarations. For example, "Hello, world!" in Java looks something like:
    public class Hello {
        public static void main() {
            System.out.println("Hello, world!");
    }whereas the equivalent in JavaFX Script is simply:
    println("Hello, world!")For larger JavaFX Script programs one usually has to add import lines and class declarations, which do tend to lead away from the "scripty" feel of the language. Nonetheless I find JavaFX Script considerably more concise than Java and, well, the authors wanted to call it a scripting language, so there it is.
    One other thing I learned recently is that to put something on the screen, it's not necessary to wrap your scene graph objects in a Stage and a Scene. If the last expression in the script is a Node, the runtime automatically provides a Stage and a Scene for you. So something like:
    import javafx.scene.paint.*;
    import javafx.scene.shape.*;
    Rectangle {
        x: 50 y: 30 width: 100 height: 40 fill: Color.DODGERBLUE
    }will work.

  • Autofilled Java Syntax

    I use Adobe Adge Animate. I'm new in Adobe Edge and Java. I'm from the PHP side and use Dreamweaver. Its not possibly to autofilled Java Syntax in Edge? I have some problems with access of some symbols and element. I'm not sure which is the right command.

    When in the code window select the arrow at the bottom to open the code snippets.
    On Fri, Feb 13, 2015 at 4:55 PM, migro1982 <[email protected]>

  • Java syntax issues

    Hi,
    I am getting syntax errors in below code,
    D:/usr/sap/XIQ/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map98ec4020b05611dfa9e0005056a47072/source/com/sap/xi/tf/_MM_RSPD_INFILE_RSPD_OUTFILE_.java:165: cannot resolve symbol symbol : class string location: class com.sap.xi.tf._MM_RSPD_INFILE_RSPD_OUTFILE_ string out1 = contractNo + tmpqtystr1 + price + delperiod.substring(0,4)+"01" + condate + shipwts + mtype + cif + comtype + rejreason ^ D:/usr/sap/XIQ/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map98ec4020b05611dfa9e0005056a47072/source/com/sap/xi/tf/_MM_RSPD_INFILE_RSPD_OUTFILE_.java:177: cannot resolve symbol symbol : class string location: class com.sap.xi.tf._MM_RSPD_INFILE_RSPD_OUTFILE_ string out2 = out1; ^ 2 errors
    is there any declaration issue..........
    string out1 = contractNo + tmpqtystr1 +  price +  delperiod.substring(0,4)+"01" +  condate +  shipwts +  mtype +  cif +  comtype +  rejreason
    +  type +   usrname +impdate +  imptime ;
    int strlen = out1.length();
    for (int s = strlen; s<178; s++)
    out1 = out1.concat("");
    string out2 = out1;
    out1 = out1.concat(delperiod.substring(0,4)+"01");
    result.addValue( out1 );
    out2 = out2.concat(delperiod.substring(0,4)+"03");
    result.addValue( out2 );

    Thanks a lot dude....
    this did solved the issue........
    lemme keep this post open.......
    seems to be some logic issue.........
    even the logic issue got solved...... thanks again....
    Edited by: san485 on Aug 25, 2010 6:13 PM

  • Java syntax and semantics

    Hi, Friends,
    Would you please tell me what is the difference of "syntax" and "semantics" in the context of Java.
    Regards,
    Youbin

    Same as any other language.
    Example:
    String moniker = "youbin1";
    The syntax is roughly <type definition> <variable name> <assignment> <value>
    The semantics is "Define a variable of the type supplied and name supplied, and give it the supplied initial value".

  • Java syntax

    I am just trying to under the syntax of java but having problem with the lines of code show below. This code is to do with JTree.
    The syntax below works.
    Enumeration allChild = route.children();
    while (allChild.hasMoreElements())
    The syntax below doesn't work.
    while (route.chlidren()).hasMoreElements())
    What have I done wrong?
    Thanks
    Peter Loo

    The syntax below works.
    Enumeration allChild = route.children();
    while (allChild.hasMoreElements())
    The syntax below doesn't work.
    while (route.chlidren()).hasMoreElements())
    What have I done wrong?Well, you spelled it "chlidren", and you're missing an opening parenthesis before "route" (or you have an extra closing one after "chlidren").

  • An unseen java syntax: " className .this"

    As I studied the Java Tutorial, "How to use File Choosers", I found a strange Java expression in FileChooserDemo.java as listed below
    public class FileChooserDemo extends JFrame {
        public FileChooserDemo() {
            final JFileChooser fc = new JFileChooser();
                // In response to a button click:
                // int returnVal = fc.showOpenDialog(aComponent);
                int returnVal = fc.showOpenDialog(FileChooserDemo.this);
    }What's "FileChooserDemo.this" really mean?
    Remark: "FileChooserDemo.this" could not be substitued with "this", it caused a compilation error.

    Hi s_plyw,
    the syntax you have seen meens that showOpenDialog() get a referenz of the current instance of FileChooserDemo. You need this syntax for inner classes, to get a referenz of the class where the inner class is nested. If you only use 'this' you will get an instance of the inner class.
    public class A {
    public int val = 5;
    public A() {
    new B();
    private class B {
    public int val = 10;
    public B() {
    System.out.println("->" + A.this.val);
    System.out.println("->" + this.val);
    public static void main(String[] args) {
    new A();
    produce:
    ->5
    ->10
    Look at the langspec (can be downloaded from the sun sites) for the syntax. I think in 'thinking in java' are more examples.
    J�rgen

  • Java syntax error : RFC Lookup

    My UDF Source code has an syntax error: missing return statement }
    but i can´t find the error.
    any ideas ?
    //write your code here
    String content = "";
    MappingTrace importanttrace;
    importanttrace = container.getTrace();
    // filling the string with our RFC-XML (with values)
    String m ="<?xml version="1.0" encoding="UTF-8"?><ns0:Z_GET_PRODH xmlns:ns0="urn:sap-com:document:sap:rfc:functions"><IN_MATNR>2100018693</IN_MATNR></ns0:Z_GET_PRODH>";
    RfcAccessor accessor = null;
    ByteArrayOutputStream out = null;
    try
         // 1. Determine a channel (Business system, Communication channel)
         Channel channel = LookupService.getChannel("xxxxxxxxxx","yyyyyyyy");
         // 2. Get a RFC accessor for a channel.
         accessor = LookupService.getRfcAccessor(channel);
         // 3. Create a xml input stream representing the function module request message
         InputStream inputStream = new ByteArrayInputStream(m.getBytes());
         // 4. Create xml payload
         XmlPayload payload = LookupService.getXmlPayload(inputStream);
         // 5. Execute lookup.
         Payload result = accessor.call(payload);
         InputStream in = result.getContent();
         out = new ByteArrayOutputStream(1024);
         byte[] buffer = new byte[1024];
         for (int read = in.read(buffer); read > 0; read = in.read(buffer))
              out.write(buffer, 0, read);
         content = out.toString();
    catch(LookupException e)
         importanttrace.addWarning("Error while lookup " + e.getMessage() );
    catch(IOException e)
         importanttrace.addWarning("Error " + e.getMessage() );
    finally
         if (out!=null)
               try
              out.close();
               catch (IOException e)
                   importanttrace.addWarning("Error while closing stream " + e.getMessage() );
         // 7. close the accessor in order to free resources.
         if (accessor!=null)
               try
              accessor.close();
               catch (LookupException e)
                   importanttrace.addWarning("Error while closing accessor " + e.getMessage() );
    Message was edited by:
            Gordon Breuer

    I have a solution without DOM parser. The XML code is seen as a sting and the code looks for a specific tag. In my case it is OUTPUT, you can adjust the code to your tag.
    String content = "";
    MappingTrace importanttrace;
    importanttrace = container.getTrace();
    // filling the string with our RFC-XML (with values)
    String m = "<rfc:ZZSG_TEST_XSLT_LOOKUP xmlns:rfc="urn:sap-com:document:sap:rfc:functions">"
                                + "<INPUT>" + request + "</INPUT></rfc:ZZSG_TEST_XSLT_LOOKUP>";
    RfcAccessor accessor = null;
    ByteArrayOutputStream out = null;
    try
    // 1. Determine a channel (Business system, Communication channel)
    Channel channel = LookupService.getChannel("Airline_Group_Two","RFC");
    // 2. Get a RFC accessor for a channel.
    accessor = LookupService.getRfcAccessor(channel);
    // 3. Create a xml input stream representing the function module request message.
    InputStream inputStream = new ByteArrayInputStream(m.getBytes());
    // 4. Create xml payload
    XmlPayload payload = LookupService.getXmlPayload(inputStream);
    // 5. Execute lookup.
    Payload result = accessor.call(payload);
    InputStream in = result.getContent();
    out = new ByteArrayOutputStream(1024);
    byte[] buffer = new byte[1024];
    for (int read = in.read(buffer); read > 0; read = in.read(buffer)) {
    out.write(buffer, 0, read);
    content = out.toString();
    catch(LookupException e)
    importanttrace.addWarning("Error while lookup " + e.getMessage() );
    catch(IOException e)
    importanttrace.addWarning("Error " + e.getMessage() );
    finally
    if (out!=null) {
    try {
    out.close();
    } catch (IOException e) {
    importanttrace.addWarning("Error while closing stream " + e.getMessage() );
    // 7. close the accessor in order to free resources.
    if (accessor!=null) {
    try {
    accessor.close();
    } catch (LookupException e) {
    importanttrace.addWarning("Error while closing accessor " + e.getMessage() );
    //returning the result – RFC-XML.response
      int start = content.indexOf("<OUTPUT>") + 8;
      int end = content.indexOf("</OUTPUT>");
      if (end > start && start > 8)
        content = content.substring(start,end);
    return content;

  • Java Dump Analysis

    How do analyze when a running java program produces a JAVADUMP.DATE... ? What may be the steps. Could somebody throw light on it? After dumping, java program crashes.
    Thanks

    ah...
    Ok. I m not too familiar with HPUX. No hpux to play with :(
    So here u go...
    http://www.hp.com/products1/unix/java/pdfs/07_06Tools_NativeDebug.pdf
    IMHO, there is more documentation on HP than on Solaris and Windows, right?

  • Java syntax question.

    other than in this example and similar
    import java.util.*;can there be a . before a *?
    I need to eliminate the bug in JRainbow that colors that * as an operator.
    http://www.ecst.csuchico.edu/~jschall/my_java/JRainbow/

    other than in this example and similar
    import java.util.*;can there be a . before a *?There could be code like this:
    double d = 5.*.5;

Maybe you are looking for

  • Help.  New Computer, Need to Move I-Tunes

    I have just got a new computer and I need to transfer my music to my new laptop. I have read the instructions on how to move them via IPOD hard drive or burning CD's. My question is, can you use an external hard drive to transfer the music over. I do

  • Supporting detail disappeared and the could not edit

    We have a planning app (v 11.1.2.2) and one user told me he entered some data into supporting detail for one cell. After he save it and the cell data became 0. And he could not edit that cell anymore. Tried to editing supporting edit for that cell br

  • How can I build and run CDC in Red Hat Linux?

    I downloaded the CDC and CVM(j2me_cdc_fp-1_0_2-src.zip), and wanted to build a VM in Red Hat Linux. But I can't find the Makefile in the "build" directory. How can I build it?

  • Deploying resource adapter

              Getting an error, trying to deploy a resource adapter.           Here's the log and exception below.           Log           preparing application TestRA on testServer           Exception caught for task Activate application TestRA on testS

  • How can I make my book being displayed on iBooks Store?

    Hi, I can search for my book on the iBooks Store by the book title,subtitle, author name, or ISBN, but I want  my book to be shown on Books<Children's Fiction>Paid category when I go to the page of iBooks Store. Apple said "Not all books are listed i