How to deal with 'Expansion within "(. . .)*" can be matched by empty string'?
<p>I am writing a JavaCC parser/lexer which is meant to recognise all input strings belonging to either of the following languages L0 or L1:</p>

<p><strong>L0</strong><br>
A string from L0 consists of several blocks separated by space characters.
At least one block must be present (i.e., no input consisting only of some number of white spaces is allowed).</p>

<ul>
<li>A block is an odd-length sequence of lowercase letters (a-z).</li>
<li>No spaces are allowed before the first block or after the last one.</li>
<li>The number of spaces between blocks must be odd.</li>
</ul>

<p><strong>L1</strong><br>
A string from L1 consists of several blocks separated by space characters.
At least one block must be present.</p>

<ul>
<li>There are two kinds of blocks. A block of the first kind must be
an even-length sequence of uppercase letters <code>(A-Z)</code>. A block of the
second kind must have the shape <code>&lt;2U&gt;. . .&lt;/2U&gt;</code>, where <code>. . .</code> stands
for any string from L0.</li>
<li>No spaces are allowed before the first block or after the last one.</li>
<li>The number of spaces between blocks must be odd.</li>
</ul>

<p>This is my code so far:</p>

<pre><code>PARSER_BEGIN(Assignment)

  /** A parser which determines if user's input belongs to L0 or L1. */
  public class Assignment {
    public static void main(String[] args) { 
      String returnString = null;
      boolean toPrintEmptyInput = false;
      try {
        Assignment parser = new Assignment(System.in);
        if(parser.Input()) {
          System.out.println("YES"); // If the user's input belongs to L0, print YES.
        } else {
          System.out.println("NO");
        }
      } catch (ParseException e) {
        System.out.println("NO");  // If the user's input does not belong to L0, print NO.      
      }
    }
  }

PARSER_END(Assignment)

//** A token which matches any lowercase letter from the English alphabet. */
TOKEN :
{
  &lt; IDLOWER: (["a"-"z"]) &gt;
}

//* A token which matches any uppercase letter from the English alphabet. */
TOKEN:
{
  &lt; IDUPPER: (["A"-"Z"]) &gt;
}

//* A token which matches a single white space. */
TOKEN : 
{
  &lt;WHITESPACE: " "&gt;
}

/** This production is the basis for the construction of strings which belong to language L0. */
boolean Input() :
{}
{
  &lt;IDLOWER&gt;(&lt;IDLOWER&gt;&lt;IDLOWER&gt;)* ((&lt;WHITESPACE&gt;(&lt;WHITESPACE&gt;&lt;WHITESPACE&gt;)*)&lt;IDLOWER&gt;(&lt;IDLOWER&gt;&lt;IDLOWER&gt;)*)* ("\n"|"\r") &lt;EOF&gt;
  {      
    return true;    
  }

  |

  {        
    return false;
  }
}

/** This production is the basis for the construction of strings which belong to language L1. */
void Input2() :
{}
{
  Input() ((&lt;WHITESPACE&gt; Input())* (&lt;WHITESPACE&gt; (&lt;IDUPPER&gt;&lt;IDUPPER&gt;)+)*)* ("\n"|"\r") &lt;EOF&gt;

  |

  (&lt;IDUPPER&gt;&lt;IDUPPER&gt;)+ ((&lt;WHITESPACE&gt; (&lt;IDUPPER&gt;&lt;IDUPPER&gt;)+)* (&lt;WHITESPACE&gt; Input())*)* ("\n"|"\r") &lt;EOF&gt;
}
</code></pre>

<p><strong>Issue:</strong>
The issue that I am having is that, when I run <code>javacc</code> on <code>Assignment.jj</code>, the following is printed out on the terminal: <code>Expansion within "(. . .)*" can be matched by empty string.</code>  I have looked at the following links, in order to try to better understand this error:</p>

<ul>
<li><a href="https://stackoverflow.com/questions/20283556/java-cc-issue-expansion-within-can-be-matched-by-empty-string">Link 1</a> (I didn't find this very helpful).</li>
<li><a href="https://java.net/projects/javacc/lists/users/archive/2009-08/message/14" rel="nofollow noreferrer">Link 2</a> (I found this fairly helpful).</li>
</ul>

<p>The second link recommended modifying the <code>. . .</code> within the expansion, such that it cannot be matched by zero.  However, I am struggling to do this while still having a production which accepts strings in L1.</p>

<p>I would appreciate <strong>hints</strong> or <strong>corrections</strong>!</p>