fork download
  1. import java.util.Arrays;
  2.  
  3. public class Ip {
  4. %% machine ip;
  5. %% write data;
  6.  
  7. public static void main(final String[] args) {
  8. int p = 0;
  9. char[] data = args[0].toCharArray();
  10. int pe = data.length;
  11. int eof = pe;
  12. int cs;
  13. int[] ip = new int[4];
  14. int pos = 0;
  15. %%{
  16. write init;
  17.  
  18. action add {
  19. ip[pos] = ip[pos] * 10 + (fc - '0');
  20. }
  21.  
  22. action next {
  23. ++pos;
  24. }
  25.  
  26. dec_octet = (digit |
  27. [1-9] . digit |
  28. "1" . digit . digit |
  29. "2" . ([0-4] . digit| "5" . [0-5]) ) $add;
  30. main := dec_octet ("." @next . dec_octet){3};
  31. write exec;
  32. }%%
  33. System.out.println(Arrays.toString(ip));
  34. }
  35. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty