Changeset 5756 in josm


Ignore:
Timestamp:
2013-03-03T21:20:18+01:00 (11 years ago)
Author:
akks
Message:

paste tags from text: fixed one more parser error, added JUnit tests, see #8384
NetBeans project: experimental testing support

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/netbeans/nbproject/project.properties

    r5320 r5756  
    11annotation.processing.enabled=false
    22annotation.processing.enabled.in.editor=false
     3annotation.processing.processors.list=
    34annotation.processing.run.all.processors=true
    45annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
     
    3132file.reference.core-src=../src
    3233file.reference.core=..
     34file.reference.test-unit=../test/unit
    3335includes=org/**/*.java,gnu/**/*.java,oauth/**/*.java,com/**/*.java,images/**,org/openstreetmap/gui/**/*.png,data/**,styles/**,LICENSE,README,CONTRIBUTION,gpl-2.0.txt,gpl-3.0.txt
    3436jar.archive.disabled=${jnlp.enabled}
     
    6769jnlp.descriptor=application
    6870jnlp.enabled=false
    69 jnlp.mixed.code=defaut
     71jnlp.mixed.code=default
    7072jnlp.offline-allowed=false
    7173jnlp.signed=false
     74jnlp.signing=
     75jnlp.signing.alias=
     76jnlp.signing.keystore=
    7277main.class=org.openstreetmap.josm.gui.MainApplication
    7378manifest.file=manifest.mf
     
    8489src.core.dir=${file.reference.core}
    8590src.dir=${file.reference.core-src}
     91test.unit.dir=${file.reference.test-unit}
  • trunk/netbeans/nbproject/project.xml

    r3931 r5756  
    99                <root id="src.core.dir"/>
    1010            </source-roots>
    11             <test-roots/>
     11            <test-roots>
     12                <root id="test.unit.dir"/>
     13            </test-roots>
    1214        </data>
    1315    </configuration>
  • trunk/src/org/openstreetmap/josm/tools/TextTagParser.java

    r5755 r5756  
    11package org.openstreetmap.josm.tools;
    22
     3import java.util.Arrays;
    34import java.util.HashMap;
    45import java.util.Map;
     
    5152                skipEmpty();
    5253                if (pos == n) { break; }
    53                 k = parseString(true);
     54                k = parseString("\n\r\t= ");
    5455                if (pos == n) { tags.clear();  break; }
    5556                skipSign();
    5657                if (pos == n) { tags.clear();  break; }
    57                 v = parseString(false);
     58                v = parseString("\n\r\t ");
    5859                tags.put(k, v);
    5960            }
     
    6162        }
    6263       
    63         private String parseString(boolean stopOnEquals) {
     64        private String parseString(String stopChars) {
     65            char stop[] = stopChars.toCharArray();
     66            Arrays.sort(stop);
    6467            char c;
    6568            while (pos < n) {
     
    8184                    pos++;
    8285                    break;
    83                 } else if (!quotesStarted && (c=='\n'|| c=='\t'|| c==' ' || c=='\r'
    84                       || (c=='=' && stopOnEquals))) {  // stop-symbols
     86                } else if (!quotesStarted && (Arrays.binarySearch(stop, c)>=0)) {
     87                    // stop-symbol found
    8588                    pos++;
    8689                    break;
     
    127130    }
    128131
    129     private static String unescape(String k) {
     132    protected static String unescape(String k) {
    130133        if(! (k.startsWith("\"") && k.endsWith("\"")) ) {
    131134            if (k.contains("=")) {
     
    137140        }
    138141        String text = k.substring(1,k.length()-1);
    139         return (new TextAnalyzer(text)).parseString(false);
     142        return (new TextAnalyzer(text)).parseString("\r\t\n");
    140143    }
    141144
Note: See TracChangeset for help on using the changeset viewer.